471,886 Members | 1,018 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,886 software developers and data experts.

Problem with option tag alignment

118 100+
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
Aug 10 '09 #1
5 5389
Dormilich
8,658 Expert Mod 8TB
you could try to float (CSS) the price right (<span> should be OK)
Aug 10 '09 #2
swethak
118 100+
Hi,


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








Thanks
Swetha
Aug 10 '09 #3
Dormilich
8,658 Expert Mod 8TB
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>
Aug 10 '09 #4
swethak
118 100+
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
Aug 11 '09 #5
Dormilich
8,658 Expert Mod 8TB
@swethak
are you using IE? then use a standard compliant Browser (Firefox, Opera, …)
Aug 11 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Matt Feinstein | last post: by
1 post views Thread by sgraber | last post: by
8 posts views Thread by gopal | last post: by
1 post views Thread by Stephen Plotnick | last post: by
10 posts views Thread by Rahul | last post: by
9 posts views Thread by Roman Mashak | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.