December 12, 200718 yr Im creating a html/css form, and i want to have those little red astrixes which show which fields are neccessary. Heres my code at the moment: <style type = 'text/css'> .redastrix { color:red; } </style> Then later on: <strong>Forename:</strong> <div class = 'redastrix'>*</div> ... Cheers in advance
December 13, 200718 yr What's your actual question? Anyway here's the correct markup for a form field... <label for="idname">My fieldname <span class="redasterix">*</span></label><input id="idname" type="text" name="fieldname" /> .redastrix { color:red; }
December 13, 200718 yr No need for them spans <label for="idname">My fieldname <strong>*</strong></label><input id="idname" type="text" name="fieldname" /> label strong { color:red; } Marking up the astrix with strong emphasize makes more semantic sence. Avoid class names indicating layout. If you where to use a span with class names for asterix' use instead <span class="astrix"> That way the class name doesn't imply a certain colour. If you where to redesign your site, or make a handheld or print stylesheet the astrix might not be red and the class name would not make sense. Anyway, what was your question?
December 13, 200718 yr Author Cheers, the problem that i was having was that it was going to a new line each time there was an astrix, but i think that was because i was using div tags instead of span tags Cheers! :D
Create an account or sign in to comment