Divider in HTML Option Tag
I want to put a dashed line divider between a value in option and other options. A pseudocode is mentioned below. Please help How do I achieve this? The dashed line should not be allowed to be selected.
<OPTION VALUE="TravelLeisure.html">Travel & Leisure
<OPTION VALUE ""> -----------
<OPTION VALUE="ymca.html">Waste Management
<OPTION VALUE="WaterManagement.html">Water Management
<option>Child option 1</option>
<option>Child option 2</option>
<option>Child option 3</option>
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
The optgroup html tag as scragar pointed out, will allow you to have an option group and you can label this group as '--------' so it will appear in the dropdown but be unselectable.
Be sure to always close your tags. <option> should have a corresponding </option>.
No it shouldn't. Well, it doesn't have to have one and you are free to omit it as it pleases you. Don't submit to people who go about making up rules. There are plenty enough real rules out there that you do need to observe.
Originally Posted by nickelleon
That "O" signifies that the closing tag is optional for the element.
<!ELEMENT OPTION - O (#PCDATA) -- selectable choice -->
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Always closing tags makes your code easier to maintain.
Just because a browser is required to be able to handle when certain tags are omitted from your page doesn't mean that it is good practice to omit them, it just means that the browsers are required to be somewhat forgiving of poor coding practices.
Last edited by felgall; 12-26-2008 at 04:13 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)