Log in

View Full Version : condense code



ggalan
07-20-2010, 03:14 AM
can i some how combine this?


#square00 a:hover { background-color:#444; }
#square01 a:hover { background-color:#444; }
#square02 a:hover { background-color:#444; }


a.class_00:hover{ color:#444; }
a.class_01:hover{ color:#444; }
a.class_02:hover{ color:#444; }

gwmbox
07-20-2010, 03:59 AM
#square00 a:hover,#square01 a:hover,#square02 a:hover{background-color:#444;}
a.class_00:hover,a.class_01:hover,a.class_02:hover{color:#444;}

traq
07-20-2010, 04:04 AM
you could list them all in a single statement:
#square00 a:hover, #square01 a:hover, #square02 a:hover,
a.class_00:hover, a.class_01:hover, a.class_02:hover{ color:#444; }or, it may be simpler to create another class to set the bg color:
.bg{ color: #444; }and apply it to all the elements you like.

In this (for example):#square00 a:hover, is #square00 the id for the <a> or for the <a>'s parent? If #square00 is the <a> itself, then you can simply write #square00:hover. Likewise, if .class_00 is only used on <a> elements, then you don't have to specify that the class belongs to the a element.

gwmbox
07-20-2010, 04:38 AM
Traq - one set is for background-color and the other is for color

Cheers

GW

ggalan
07-20-2010, 04:45 AM
thank you for the response, i have a class set already but this gave ideas
thanks again
cheers

traq
07-20-2010, 02:45 PM
Traq - one set is for background-color and the other is for color

Cheers

GW

whops - missed that! but glad I could help anyway.