CSS and tables

N

News Hippo

Hi,

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:

http://builder.com.com/5100-6371_14-5244791.html

if you duplicate the html code and change

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

to
<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.
Lisa
 
E

Els

News said:
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

(those are classes that are used on table cells inside more than one
table)
so that they too
only apply to the table id "sample"?

table#sample .leftcoll{...}
table#sample .data{...}

etc.
 
A

Andy Dingley

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

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.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top