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

How to put formatted text in <Select> <Option> tag

Status
Not open for further replies.

dasher40

Programmer
Oct 18, 2003
2
US
I want to make a multiple column select box and have values for each column line up. I have tried using <pre> in the <option> tag but it is ignored.

How can I format line up column by using spaces in the <option> tag?


example:
<select size=&quot;7&quot; name=&quot;D1&quot; style=&quot;border-style: double; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1&quot;>
<option value=&quot;val1&quot;><pre>Kona Dog Brown </pre> </option>
<option value=&quot;val2&quot;><pre>Dakota Dog Red </pre> </option>



dan
 
>>format line up column??? i am not able to understand, no HTML tags other than <option> tag will work inside a <select> tag...

Known is handfull, Unknown is worldfull
 
Sory for the confusing post. How do I keep formatted text &quot;extra spaces&quot; inside a select box? I want to use extra spaces to make the select box entries (&quot;<option>&quot;) look like a multiple column select box.

each entry in the select box has multiple values, and I want them to line up in columns. Hence making the select box look like it has multiple columns.

dan
 
All I can think of is this:
Code:
<select style=&quot;font-family: courier; font-size: 10pt;&quot;>
 <option value=&quot;val1&quot;>Kona& nbsp;& nbsp;& nbsp;|& nbsp;Dog& nbsp;|& nbsp;Brown</option>
 <option value=&quot;val2&quot;>Dakota& nbsp;|& nbsp;Dog& nbsp;|& nbsp;Red</option>
</select>
I've chosen Courier font because of the same spacing for each letter. If you want to show your white spaces in html, you need to use this & n b s p; (written together, only space will be seen if I write it together here). That means non-breaking space.

Hope it helps.
 
try removing the pre tag, event Kara asdasd asdasd ought to work...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top