471,603 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Can't line up texts

Hi,
I am having problem lining up two labels on two lines below each
other. I have:
text --- dropdown --- text --- dropdown
text --- dropdown --- text --- dropdowns

and even though I specified same width for both texts, within a span,
the dropdowns don't line up.

<div style="width:100%">
<span style="width:150px;">Select Month</span>
<span style="padding-right:30px">
<asp:DropDownList Width="150px">
</asp:DropDownList>
</span>
<span style="width:150px;">Select Year</span>
<span>
<asp:DropDownList Width="150px">
</asp:DropDownList>
</span>
</div>

<div style="padding:20px 0 20px 0;width:100%;">
<span style="width:150px;">Select Report Type</span>
<span style="padding-right:30px">
<asp:DropDownList Width="150px">
</asp:DropDownList>
</span>
<span style="width:150px;">Select Site</span>
<span>
<asp:DropDownList Width="150px">
</asp:DropDownList>
</span>
</div>

Thanks.
Nov 15 '07 #1
2 1804
as*******@hotmail.com wrote:
>
and even though I specified same width for both texts, within a span,
the dropdowns don't line up.

<span style="width:150px;">Select Month</span>
http://www.w3.org/TR/CSS21/visudet.html#propdef-width
"Applies to: all elements but non-replaced inline elements, table
rows, and row groups"

Span is a non-replaced inline element, so width doesn't apply.

BTW, you should be using <labelinstead of <spanfor those form
labels. That's what it's for. And you can probably get all your other
form styling questions answered yourself:
http://www.google.com/search?q=style+forms+with+css

--
Berg
Nov 15 '07 #2
On Nov 15, 5:30 pm, Bergamot <berga...@visi.comwrote:
ashkaa...@hotmail.com wrote:
and even though I specified same width for both texts, within a span,
the dropdowns don't line up.
<span style="width:150px;">Select Month</span>

http://www.w3.org/TR/CSS21/visudet.html#propdef-width
"Applies to: all elements but non-replaced inline elements, table
rows, and row groups"

Span is a non-replaced inline element, so width doesn't apply.

BTW, you should be using <labelinstead of <spanfor those form
labels. That's what it's for. And you can probably get all your other
form styling questions answered yourself:http://www.google.com/search?q=style+forms+with+css

--
Berg
Thanks. I learned something new today. I used lables and it is fine.
Nov 16 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by tramoman | last post: by
14 posts views Thread by Haines Brown | last post: by
5 posts views Thread by Dario de Judicibus | last post: by
7 posts views Thread by mattrapoport | last post: by
6 posts views Thread by Markus Ernst | last post: by
9 posts views Thread by SuperNova | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | 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.