Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / July 2007



Tip: Looking for answers? Try searching our database.

all div elements with the same (flexible) width

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kai Rosenthal - 30 Jul 2007 08:10 GMT
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
Andy Dingley - 30 Jul 2007 09:12 GMT
> 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.
Ben C - 30 Jul 2007 11:28 GMT
>> How can I get the same width for all div elements with every font
>> size?
[quoted text clipped - 7 lines]
> 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.
Bergamot - 30 Jul 2007 13:28 GMT
> 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.

Signature

Berg

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.