Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add breaks in select box options

Status
Not open for further replies.

nmath

Programmer
Dec 12, 2003
47
0
0
US
Does anyone know if there is a way to have a "return" in a select box? I tried <option>Test<br>This</option> and it simply ignored the <br> Does anyone have any ideas?? Thanks in advance!!!
 
The age old problem of long text in a select box... As far as a I know, it hasn't been solved yet. You can use option grouping and kinda make it look like on selection....

Code:
<style>
	.og1 {background-color:yellow;}
	.og2{background-color:green;}
</style>

<select size=2>
	<optgroup class="og1" label="option 1">
		<option value="This is some very long text that I want to shorten">This is some very long text
		<option value="This is some very long text that I want to shorten">That I want to shorten
	</optgroup>
	<optgroup class="og2" label="option 2">
		<option value="This is more very long text because I am too wordy">This is more very long
		<option value="This is more very long text because I am too wordy">because I am too wordy
	</optgroup>
</select>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top