Using CSS with Grids/Tables

T

tshad

I am trying to set up various grids with different displays and don't want
to set each row and column individually.

Right now I use the following in my css page:

table {
border-collapse: separate;
border-color:#999999
}
th {
background-color:#000000;
color:white;
text-decoration: none;
border-style:none;
vertical-align:bottom;
font-size:14px;
}
td {
empty-cells: show;
text-align:left;
}

But this sets all the tables in the application the same.

What I am trying to do is something like:

standard.table
standard.td
standard.th
customer.table
customer.td
customer.th
client.table
client.td
client.th

Is there a way to do something like this and just assign one of the 3 to a
particular table using css?

Thanks,

Tom
 
N

neilmcguigan

you can combine css tags like this:

ClassName element { style }

so if your grid has a CssClassName of MyGrid:

MyGrid th { font-family:tahoma }

or even

MyGrid th, MyOtherGrid th { some style }
 
T

tshad

Would each of the tags have to have a "." on them?

For example:

..MyGrid table {border-color:#2f2f2f}
..MyGrid th { font-family:tahoma }
..MyGrid td {text-align:left}

Then do something like:

<asp:DataGrid CssClass="MyGrid" ...

Thanks,

Tom
 
N

neilmcguigan

not entirely sure what you mean...

a css class when declared in css, needs a "." at the beginning, but not
in the html tag itself

<style>

th {some style}

..SomeClass {some style}

#anID {some style}

</style>

you can refer to the id of an element using #
you can refer to the class of an element using .
you can refer to an element using its tag

in html would be like this:

<th class="SomeClass" id="anID">
 
T

tshad

I am referring to your example.

You have:

MyGrid th...
or
MyGrid th, MyOtherGrid th

There are no "."s there.

Where would I set this in HTML, since as you said the statement would
typically be:

<th class="SomeClass" id="anID">

where SomeClass would be ".SomeClass" in the css file.

How would I use MyGrid in my HTML?

I am would like to make all the <td><th><tr> different for different grids
(MyGrid, MyOtherGrid).

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top