473,392 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 3021
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Luke McCarthy | last post by:
Hi, I'm trying to accomplish what I (perhaps naively) assumed would be a relatively easy task. I am trying to center a box in the middle of the display. That's all. Something like this here:...
6
by: Christopher Benson-Manica | last post by:
http://ataru.gomen.org/files/html/files/test.html: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Test page</title> <style...
8
by: Terry | last post by:
Trying my hand at table-less design. Looking for an XHTML 1.0 strict, CSS2 compliant solution. Here's the result I'm looking for: Div I: Some header text DIV II: Some text and a form which...
1
by: James Fortune | last post by:
Flexible Reports I only did this because a client required this functionality. No guarantees or rights are implied by the code shown here. It is provided mostly for those with extra time on...
2
by: TB | last post by:
Hi All: I have this datagrid where space is very tight, and therefore I have to make sure that everything fits within a fixed screen width regardless of whether I am in list mode or in edit...
9
by: Daniel Kabs | last post by:
Hello there again! On my quest to remove layout tables in favor of CSS controlled elements, I am faced with quite a problem. A table cell that has no explicit width attribute set usually...
0
by: jitu78 | last post by:
Hi, I am working on pure DIV based layout. See below for layout requirements, 1) Page should be 100% flexible for all resolutions. 2) There should be maximum and minimum limit for page width...
1
by: itgirl | last post by:
I am designing the master page and now I have run into the problem with the page size. I want the flexible size-width and height of the page fit with any resolution of the screen when I maximize it...
14
by: gaijinco | last post by:
I was a hobbist web coder for years but I had to sidestep for a while. Now I'm trying to return to it and I'm trying to clarify how am I supposed to do somethings with CSS v.s. HTML and I'm...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.