By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,534 Members | 1,807 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,534 IT Pros & Developers. It's quick & easy.

all div elements with the same (flexible) width

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.