473,408 Members | 1,857 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,408 software developers and data experts.

horizontal column layout

given 3 boxes, where box1 contains box2 and box3, box1.width =
box2.width + box3.width and box1.height = max(box2.height,
box3.height):

+-------------+
|+----++-----+|
|| || ||
|| || ||
|+----+| ||
| | ||
| +-----+|
+-------------+

All boxes are divs. Is it possible to do this with CSS/HTML without
using the string "table" and without using Javascript? I've tried
this with float and position:absolute for box2 or box3 but the space
of an absolutely positioned/floating box doesn't matter for the
containing box1.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 21 '05 #1
8 6171
Els
Peter Maas wrote:
given 3 boxes, where box1 contains box2 and box3, box1.width =
box2.width + box3.width and box1.height = max(box2.height,
box3.height):

+-------------+
|+----++-----+|
|| || ||
|| || ||
|+----+| ||
| | ||
| +-----+|
+-------------+

All boxes are divs. Is it possible to do this with CSS/HTML without
using the string "table" and without using Javascript? I've tried
this with float and position:absolute for box2 or box3 but the space
of an absolutely positioned/floating box doesn't matter for the
containing box1.


Correct.
You need to do it without position:absolute :-)

box2: float:left;
box3: margin-left:[width of box2];
after box3, before end of box1:
an element with 'clear:both'.
This will make box1 stretch to encompass both box2 and box3.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Dave Edmunds - Paralyzed
Jul 21 '05 #2
Els schrieb:
Correct.
You need to do it without position:absolute :-)

box2: float:left;
box3: margin-left:[width of box2];
after box3, before end of box1:
an element with 'clear:both'.
This will make box1 stretch to encompass both box2 and box3.


Thanks! I'm trying hard to ban table based layout but I think it is
often difficult to replace table based solutions by CSS solutions.
"Difficult" in the sense that you have to use "tricks" like an
additional box with clear:both to stretch the container.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 21 '05 #3
Els
Peter Maas wrote:
Els schrieb:
Correct.
You need to do it without position:absolute :-)

box2: float:left;
box3: margin-left:[width of box2];
after box3, before end of box1:
an element with 'clear:both'.
This will make box1 stretch to encompass both box2 and box3.


Thanks! I'm trying hard to ban table based layout but I think it is
often difficult to replace table based solutions by CSS solutions.
"Difficult" in the sense that you have to use "tricks" like an
additional box with clear:both to stretch the container.


That's only the start of all the hacks you'll need ;-)

Floats and clear properties trigger all kinds of funny happenings in
IE. Write down the term 'peek-a-boo bug' for future reference :-)

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Squeeze - Slap And Tickle
Jul 21 '05 #4
Peter Maas wrote:
Els schrieb:
Correct.
You need to do it without position:absolute :-)

box2: float:left;
box3: margin-left:[width of box2];
after box3, before end of box1:
an element with 'clear:both'.
This will make box1 stretch to encompass both box2 and box3.

Thanks! I'm trying hard to ban table based layout but I think it is
often difficult to replace table based solutions by CSS solutions.


Well you could also try CSS (display: table-cell etc.) for a layout that
looks/behaves like the normal presentation of an HTML table without
misusing HTML table-related elements. But you explicitly didn't want to
use the string 'table'.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 21 '05 #5
in comp.infosystems.www.authoring.stylesheets, Peter Maas wrote:
given 3 boxes, where box1 contains box2 and box3, box1.width =
box2.width + box3.width and box1.height = max(box2.height,
box3.height): All boxes are divs. Is it possible to do this with CSS/HTML without
using the string "table" and without using Javascript?


Easy:
div {float:left;border:solid;}
Other way (less supported):
div {display:inline-block;border:solid;vertical-align:top;}

If you have some other divs as those boxes, use different selector.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Support me, buy Opera:
https://secure.bmtmicro.com/opera/bu...tml?AID=882173
Jul 21 '05 #6
Lauri Raittila schrieb:
in comp.infosystems.www.authoring.stylesheets, Peter Maas wrote:
given 3 boxes, where box1 contains box2 and box3, box1.width =
box2.width + box3.width and box1.height = max(box2.height,
box3.height):
All boxes are divs. Is it possible to do this with CSS/HTML without
using the string "table" and without using Javascript?

Easy:
div {float:left;border:solid;}


This works but then a footer div would appear at the right side
of the rightmost box. There has to be some additional stuff as
pointed out by Els.
Other way (less supported):
div {display:inline-block;border:solid;vertical-align:top;}


Thanks for the hint, never heard of inline-block. I'll look it up
at W3C.

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 21 '05 #7
Johannes Koch schrieb:
Peter Maas wrote:
Thanks! I'm trying hard to ban table based layout but I think it is
often difficult to replace table based solutions by CSS solutions.

Well you could also try CSS (display: table-cell etc.) for a layout that
looks/behaves like the normal presentation of an HTML table without
misusing HTML table-related elements.


But wouldn't this mean to use a 3-stage hierarchy of display: table,
table-row and table-cell in the stylesheet? And a corresponding
div hierarchy in HTML with the same inclusion structure as with
<table>?

This looks to me like a rename-workaround to avoid committing the
"sin" of using tables for layout. Like the catholic monks in medieval
times who used to mumble "ego te baptizo carpam" to enjoy meat dishes
on fridays ;)

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0BtcGx1c3IuZGU=\n'.decode('base64')
-------------------------------------------------------------------
Jul 21 '05 #8
Peter Maas wrote:
But wouldn't this mean to use a 3-stage hierarchy of display: table,
table-row and table-cell in the stylesheet? And a corresponding
div hierarchy in HTML with the same inclusion structure as with
<table>?
No, not necessarily. Read about implicitly created blocks.
This looks to me like a rename-workaround to avoid committing the
"sin" of using tables for layout. Like the catholic monks in medieval
times who used to mumble "ego te baptizo carpam" to enjoy meat dishes
on fridays ;)


The purpose of table markup is not for arranging things only, but also
for making relationships explicit (headers), adding summaries for
accessibility, etc. Non-visuals tools extract information from table
markup. OTOH, the purpose of CSS table-cell etc. is just for arranging
things. That's the difference, IMHO.
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Roderik | last post by:
Hi, At http://archytas.nl/ there appears to be a horizontal scrollbar when using Mozilla Firebird (not in IE). The website (container DIV) should be 770 px wide, so there shouldn't be any reason...
8
by: Zak McGregor | last post by:
Hi all I have a simple 3 column css layout here: http://www.carfolio.com/newlook.dhtml However, when the centre column is wider than the screen (yes, it does happen on some pages on the site...
15
by: theo | last post by:
Hi, I'm working on a horizontal row menu, to use like folder tabs. Does anyone know what the CSS style "cursor" is supposed to produce? Any working samples? I put it in the code, but can't see...
5
by: McGeeky | last post by:
I am looking for a horizontal menu that has the "two row" layout - where the top row contains the top level menu items and the second contains the sub menu items. When a menu item is selected from...
1
by: Lubomir | last post by:
Hi, I have a ListView with one column and no header. How to display the horizontal scrollbar if one of the items is too long? Scrolable property is set to true. Thanks, Lubomir
3
by: hzgt9b | last post by:
I want a page with a centered div containing two rows. Top row has an image and some text. The bottom row needs to have three columns. I'd love to have the 1st column set to a fixed width then have...
1
Death Slaught
by: Death Slaught | last post by:
I will be showing you how to make a very simple but effective three column layout. First we will begin with the HTML, or structure, of our three column layout. <!DOCTYPE html PUBLIC...
19
by: Jim | last post by:
Hi, I have two questions/problems pertaining to CSS horizontal dropdown menus and am hoping that someone here can help me out. (1) I'm having a problem centering the menu. I picked up the...
1
by: amuven | last post by:
Hi All, I need to put a horizontal scroll bar for 4 cells alone where my first cell in table should not contain any horizontal scroll bar . In clear, let us say there are 5 columns in my...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.