473,385 Members | 1,341 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,385 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 6169
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.