Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

style based on another style 1

Status
Not open for further replies.

giordan0

Programmer
Jul 18, 2001
40
SI
I have one style for my rows called:
.Row1 {a lot of attributes}

I'd like to make a new style
.Row2{}
based on Row1 with only one different attribute : color.

I don't want to retype all the attributes from Row1 manually.

How can I do this?
 
Here it is:

.row1 {a lot of attributes}
#newcolor { color: ... }

<p class=&quot;row1&quot; id=&quot;newcolor&quot;>

The combination of CSS classes and IDs is very powerful and flexible.
 
I'd like to use only the class attribute, because in my Web application I use ID for programming.
Is possible something like this:

.Row1 {a lot of attributes}
.Row2 {class:Row1;color:red}

 
Well, this is what you can use:

.row1 {a lot of attributes}
.row2 { color:red }

<p class=&quot;row1 row2&quot;>

Use exactly the same syntax as I wrote. Properties of row2 will override the ones form row1 (if they exist in both) or will be added to the new compound definition.

This works Opera, IE, Mozilla/N6 but doesn't work in NN4.x and this is the reason why I don't use it (cross-browser is critical).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top