CSS and tables

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I know how to add an ID to my css file and apply it to the table in my
html code. Question if I have more than one table how do I redefine
the following css code to only apply to a particular table?

Not mine, but a page that shows what I want to do:


if you duplicate the html code and change

    <table id="sample" cellspacing="2">

    <table id="sampletest" cellspacing="2">

the css definitions of .data, .toprow, .leftcol get applied to the
second table.

I understand the following as only applying to a table with id sample

table#sample {
table#sample td {

basically how do I redefine .data, .toprow, .leftcol so that they too
only apply to the table id "sample"?

Thanks in advance for any help.

Re: CSS and tables

News Hippo wrote:

Quoted text here. Click to load it

(those are classes that are used on table cells inside more than one

Quoted text here. Click to load it

table#sample .leftcoll
table#sample .data


Els                     http://locusmeus.com /

Now playing: Emerson, Lake & Palmer - Tarkus

Re: CSS and tables

News Hippo wrote:

Quoted text here. Click to load it

Try this

table#sample td.data { ... }

Watch out for whitespace!  If the qualifier (class or id) touches the
element name, then the selector matches elements that have that
qualifier themselves. If there's whitespace between them, then instead
they match a _child_ element that has that qualifier.

Site Timeline