Issue
I would like to make groups of the text content of an <option /> tag. Say I have the following: 
<select>
  <option>CCB - AFHT Crew Balancing</option>
  <option>WFM - Force Majere</option>
  ....
  ....
  <option>WWW - Adjacent TRK Form B</option>
  <option>MAH - Air Hose Separation</option>
  ....
  ....
  <option>IIS - Chassis Shortage RR</option>
  <option>WFL - Flooding</option>               
</select>
In UI, the dropdown displaying like this ↓ , but I have to display like this ↓
I was thinking of doing something like
<option><span style="width:30px;">CCB</span><span>- AFHT Crew Balancing</span></option>
But It is not working because Options tag won't allow any other sub tags.
Solution
Use a monospace font so every character has the same width:
<select style="font-family:'Courier New'">
  <option>CCB - AFHT Crew Balancing</option>
  <option>WFM - Force Majere</option>
  <option>WWW - Adjacent TRK Form B</option>
  <option>MAH - Air Hose Separation</option>
  <option>IIS - Chassis Shortage RR</option>
  <option>WFL - Flooding</option>               
</select>
Answered By - Code Different
 


0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.