Nesting (?) CSS

R

rsimpson505

Probably I have missed something, but how do you use one style
definition inside another?
For example:
I want to define two styles of <td> tags, td1 td2, which share some
properties from style tdg and have some individual properties:

td.tdg {
width: 30;
height: 50;
border-left: solid 1px gray;
border-top: solid 1px gray
}
td.td1 {
<!-- want to use td.tdg definition here -->
border-right: solid 1px gray;
border-bottom: solid 1px gray
}
td.td2 {
<!-- want to use td.tdg definition here -->
border-right: solid 1px gray;
border-bottom: solid 2px navy
}

How do I do this?

PS Do you call this cascading, nesting, including - or something else?
 
S

Steve Pugh

Probably I have missed something, but how do you use one style
definition inside another?

You don't.
I want to define two styles of <td> tags, td1 td2, which share some
properties from style tdg and have some individual properties:

td.tdg, td.td1, td.td2 { common styles }
td.td1 { unique styles }
td.td2 { unique styles }
PS Do you call this cascading, nesting, including - or something else?

As it doesn't exist in CSS terms it isn't called anything at all.

Steve
 
R

rsimpson505

Thanks Steve,
That's clear - and it works.
R

Steve said:
You don't.


td.tdg, td.td1, td.td2 { common styles }
td.td1 { unique styles }
td.td2 { unique styles }


As it doesn't exist in CSS terms it isn't called anything at all.

Steve
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
Probably I have missed something, but how do you use one style
definition inside another?
For example:
I want to define two styles of <td> tags, td1 td2, which share some
properties from style tdg and have some individual properties:

td.tdg {
width: 30;
height: 50;
border-left: solid 1px gray;
border-top: solid 1px gray
}
td.td1 {
<!-- want to use td.tdg definition here -->
border-right: solid 1px gray;
border-bottom: solid 1px gray
}
td.td2 {
<!-- want to use td.tdg definition here -->
border-right: solid 1px gray;
border-bottom: solid 2px navy
}

How do I do this?

I think you can just use class="tdg td1" ("tdg td2").

Try it. If not -

Change "td.td1" to "td.tdg td.td1,td.tdg td.td2". Then: class="tdg
td1" (or "tdg td2") in the tds.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top