Connecting Tech Pros Worldwide Help | Site Map

Problem with option tag alignment

Member
 
Join Date: May 2008
Posts: 118
#1: Aug 10 '09
Hi,


i am using the select box consits the option items in option tag .I have displayed the two items in option tag.i,e product name is to align left and product price is to align right .How can apply css to this feature.

I used like this
Expand|Select|Wrap|Line Numbers
  1. <option value="">Product name &nbsp;&nbsp;&nbsp;product price</option> 
  2.  
But in case long length product names,short length product names it will not align properly. If any body please help me.Its very urgent.



Thanks
Swetha
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#2: Aug 10 '09

re: Problem with option tag alignment


you could try to float (CSS) the price right (<span> should be OK)
Member
 
Join Date: May 2008
Posts: 118
#3: Aug 10 '09

re: Problem with option tag alignment


Hi,


Thank you for your reply.But span tag is not working inside option tag.Please suggest other ways.








Thanks
Swetha
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: Aug 10 '09

re: Problem with option tag alignment


well, this is working for me…
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
  4.     <head>
  5.         <meta http-equiv="content-type" content="application/xhtml+xml;charset=utf-8" />
  6.         <meta http-equiv="content-style-type" content="text/css" />
  7.         <meta http-equiv="content-script-type" content="text/javascript" />
  8.         <title>test centre</title>
  9.         <style type="text/css">
  10. /* <![CDATA[ */
  11. option span {
  12.     float: right;
  13. }
  14.  
  15. option {
  16.     width: 10em;
  17. }
  18. /* ]]> */
  19.         </style>
  20.     </head>
  21.     <body>
  22.         <form>
  23.             <select size="1">
  24.                 <option><span>3,50</span>Muskeln</option>
  25.                 <option><span>2,74</span>Sehnen</option>
  26.                 <option><span>213,90</span>Knochen</option>
  27.                 <option><span>39,62</span>Knorpel</option>
  28.                 <option><span>89,12</span>Blut</option>
  29.                 <option><span>47,08</span>Zellen</option>
  30.                 <option><span>38,91</span>Grips</option>
  31.             </select>
  32.         </form>
  33.     </body>
  34. </html>
Member
 
Join Date: May 2008
Posts: 118
#5: Aug 11 '09

re: Problem with option tag alignment


Hi,


Thank you for your reply.I run the above mentioned code .But it will not work.Please suggest how i can approch.









Thanks
Sravani
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#6: Aug 11 '09

re: Problem with option tag alignment


Quote:

Originally Posted by swethak View Post

Thank you for your reply.I run the above mentioned code .But it will not work.

are you using IE? then use a standard compliant Browser (Firefox, Opera, …)
Reply