Forum Moderators: not2easy

Message Too Old, No Replies

css label twice

         

wood1e

12:01 pm on May 2, 2005 (gmt 0)

10+ Year Member



hi, is it possible to have label used twice, as I have two forms on my webpage, one with white font and one with black font.

createErrorMsg

12:11 pm on May 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. You can do this any number of ways depending upon what your layout looks like. The most universal way is to create two classes of labels, assign each class the styles you want, and then apply each style to the labels that need them...

html:
<form>
<label class="top_label">Blah...</label>
</form>
<form>
<label class="bottom_label">Blah...</label>
</form>

css:
.top_label{
color:#000;
}
.bottom_label{
color:#fff;
}

A somewhat less labor intensive version would be to assign each FORM a unique id (which is a good idea, anyway) and then use the cascade to hit the labels within each one...

html:
<form id="top_form">
<label>Blah...</label>
</form>
<form id="bottom_form">
<label>Blah...</label>
</form>

css:
#top_form label{
#000;
}
#bottom_form label{
color:#fff;
}

cEM