Currently, I am working on creating a drop-down menu using the <select>
tag in HTML. Is there a way to use CSS or HTML to display the name attribute of the <select>
tag at the top of the menu when it is collapsed? In other words, I want the name to be visible even when the menu is not expanded.
For instance:
<select name="animals">
<option>Dogs</option>
<option>Cats</option>
</select>
I need the "animals" label to remain visible regardless of whether the menu is collapsed or expanded.
Also, the <optgroup>
tag does not provide the functionality I am seeking.