Dumba$$ CSS question

charlie_82

Expert Member
Joined
Dec 11, 2007
Messages
2,993
Reaction score
1
Location
Johannesburg
I highly doubt this is possible but I thought I'd try my luck...

I have a form and I want all the * that I'm using to mark required fields to be a specific colour...

Is it possible to specify this in CSS without having to use spans etc in my HTML?
There's gonna be quite a few * and hate repeating code...
 
Last edited:
Is it possible to specify this in CSS without having to use spans etc in my HTML?


That's cheating :)

I would wrap all the required fields in a class, forget about the *, then put whatever indication of the field's requiredness in css.

For example:
HTML:
<label for="name">Your Name</label>
<input id="name" name="name" type="text" [COLOR="Red"]class="required"[/COLOR] />

Then, in your css:
HTML:
input.required {
border: 1px solid red;
etc
}

You could put a background image or whatever you wanted in the div and would have more control over the styling.

2c, use it / don't use it.
 
LOL I was trying to avoid puttin gin additional tags in my html :(
It's cool tho, I don't think this is do-able
 
Top
Sign up to the MyBroadband newsletter
X