469,573 Members | 1,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

all div elements with the same (flexible) width

Hello,

I have two or more div elements which have the same min-width.
<div class="wrapper">
<div class="element01">text01</div>
<div class="element02">text02</div>
...
</div>

In a browser with normal font size all div elements have the same
width (min-width).

When I change the font size in browser some (but not all) div elements
become more largely than min-width. I get different widths for the div
elements.
How can I get the same width for all div elements with every font
size?

I don't want to work with tables.

Thanks for your hints, Kai

Jul 30 '07 #1
3 2803
On 30 Jul, 08:10, Kai Rosenthal <kairosent...@tiscali.dewrote:
How can I get the same width for all div elements with every font
size?
You should start by posting a URL to a working page, with the CSS --
not a fragment that's only the HTML and includes none of the relevant
CSS at all.

Otherwise it's a trivial exercise in CSS to set the width of the
<div>. Normally the initial value for the width property is "auto",
which causes its width to be calculated automatically on the basis of
the size of the content inside it. If you don't want that, just set it
to something else. Any of the length units will do this, but the usual
recommendation for em units rather pixels means that it works better
when text is re-sized.

Jul 30 '07 #2
On 2007-07-30, Andy Dingley <di*****@codesmiths.comwrote:
On 30 Jul, 08:10, Kai Rosenthal <kairosent...@tiscali.dewrote:
>How can I get the same width for all div elements with every font
size?

You should start by posting a URL to a working page, with the CSS --
not a fragment that's only the HTML and includes none of the relevant
CSS at all.

Otherwise it's a trivial exercise in CSS to set the width of the
<div>. Normally the initial value for the width property is "auto",
which causes its width to be calculated automatically on the basis of
the size of the content inside it.
Only for elements with shrink-to-fit widths (floats, tables, absolutely
positioned stuff). Otherwise auto width is set "greedily" so the outer
margin width of the element fills its available width completely.
Jul 30 '07 #3
Kai Rosenthal wrote:
>
How can I get the same width for all div elements with every font
size?
A URL would be helpful, but generally speaking you can use % widths:
50% each for 2 columns, 33% for 3 columns, etc.

--
Berg
Jul 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Luke McCarthy | last post: by
6 posts views Thread by Christopher Benson-Manica | last post: by
1 post views Thread by James Fortune | last post: by
2 posts views Thread by TB | last post: by
14 posts views Thread by gaijinco | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.