KevinM1 Posted June 28, 2007 Share Posted June 28, 2007 Is it possible to format <option> tags with CSS? I'd like to have a part of the text within each of my option elements bold. Trying a <span> in a PHP echo statement hasn't worked. Along the same lines, is there any way for me to include tabs in an option element to help facilitate even spacing of the text within them? Using \t in a PHP echo statement didn't work. Thanks! Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted June 28, 2007 Share Posted June 28, 2007 you should be able to use a class and just apply that class to the option element <style> .blah { font-weight: bold; } </style> <select name="name"> <option class="blah" value="value">hahahaha</option> <option value="value">hahahaha</option> <option class="blah" value="value">hahahaha</option> </select> Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted June 28, 2007 Author Share Posted June 28, 2007 you should be able to use a class and just apply that class to the option element <style> .blah { font-weight: bold; } </style> <select name="name"> <option class="blah" value="value">hahahaha</option> <option value="value">hahahaha</option> <option class="blah" value="value">hahahaha</option> </select> The above creates something like the following, correct? hahahaha hahahaha hahahaha That's not what I'm looking for. Instead, I want something like: Event Name: Some event Event Name: Another event Event Name: Third event Quote Link to comment Share on other sites More sharing options...
soycharliente Posted June 28, 2007 Share Posted June 28, 2007 I looked in a couple of places and the best answer that I can give is: You can't have other tags inside an option tag. Therefore, you can only apply style to the entire element and not just a certain part. Another observation: Why do you want to put the words "Event Name" on every single option? That seems a little redundant. Just bring the text out and put it before the drop down box. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted June 29, 2007 Author Share Posted June 29, 2007 I looked in a couple of places and the best answer that I can give is: You can't have other tags inside an option tag. Therefore, you can only apply style to the entire element and not just a certain part. Another observation: Why do you want to put the words "Event Name" on every single option? That seems a little redundant. Just bring the text out and put it before the drop down box. True, putting 'Event Name' in each option is redundant. For my project, I was planning to highlight user names which are taken from the database as each option is created. Guess that's not possible. Thanks for answering. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.