Elemental Posted December 2, 2008 Share Posted December 2, 2008 Hey Folks, I recently went on a site, and since I'm learning I took a peak at their source code and saw the following: <div class="hint required">= Required field</div> the above source code displayed the following:*= Required fieldHowever there's no * (asterisk) in the actual code, so how is it being displayed?Does it have anything to do with the css class? I thought of javascript but why bother for just one character?The site was http://www.spherion.com/ but it's in their "Spherion Candidate Resource Center" so you would need to be registered with them, and NO I'm not a recruiter I'm looking for work. I could copy and paste the source code if that would help, let me know...Peace,Elemental Link to comment Share on other sites More sharing options...
Synook Posted December 2, 2008 Share Posted December 2, 2008 Two ways (with CSS) - you could either use a background image with an asterix and give a bit of padding so that the text goes after the image, or use :before, content: and string() - that method is not supported by IE 6 however. required:before { content:string("*");} Link to comment Share on other sites More sharing options...
Elemental Posted December 3, 2008 Author Share Posted December 3, 2008 Two ways (with CSS) - you could either use a background image with an asterix and give a bit of padding so that the text goes after the image, or use :before, content: and string() - that method is not supported by IE 6 however.required:before { content:string("*");} Synook, Thank you for your reply,All that just to display an asterisk?! Is there a significant or specific value to the * that may cause a conflic with "regular" source code that would justify the need for the extra steps ?Peace,Elemental Link to comment Share on other sites More sharing options...
Ingolme Posted December 3, 2008 Share Posted December 3, 2008 I think they did it so that they can just write something like this <label class="required">Name</label><label class="required">E-mail</label> It has more meaning, an XML parser could read it and make use of it. Link to comment Share on other sites More sharing options...
Synook Posted December 3, 2008 Share Posted December 3, 2008 Also, what if they decide to use a different character for a required field, other than an asterix, in the future? Flexibility. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.