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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML FORM Align text in Select Box

Status
Not open for further replies.

mobbarley

IS-IT--Management
Mar 4, 2004
22
0
0
AU
Hi. I am using ASP to return some text strings from different variables to populate a <select> listbox.

I am wondering if there is a way to align multiple text strings into columns, something like a left justify within the list. Multiple spaces for example are ignored, thus eliminating the space() function?

eg:
<option><%=Var1%> & " " & <%=Var2%></option>

Thanks,
John.
 

I don't think you will be able to achieve this. Your best bet might be to investigate using optgroup, which lets you group elements under headings for those browers that support it.

Have you thought about trying to represent your data in some other way?

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]

 
Have you tried using &nbsp; instead of space?

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 

Looks like I was totally wrong in my understanding of select boxes... as Tracy suggests, using non-breaking spaces will work, as long as you are using a monospaced font:

Code:
<html>
<body>
	<form>
		<select style="font-family:courier new;">
			<option>Cat&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Brown</option>
			<option>Tortoise&nbsp;&nbsp;Green</option>
			<option>Whale&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Blue</option>
		</select>
	</form>
</body>
</html>

Hope this helps,
Dan




[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]

 
BRPS: Thanks for mentioning the monospaced font. I forgot that part.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top