473,473 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Lining up four DIVs horizontally

I have four roughly square DIVs, all the same height, which I need to
line up horizontally across the page. What would be the best way to do
this? At the moment I have a very botched solution where I have
display:table-cell set on each of the DIVs. This works as far as
lining them up is concerned, however to get any spacing between them
the only thing I could do was to put some   in between each one
(margin had no effect).

This works, in Firefox & Safari, but not in IE where the boxes line up
vertically. Also, adding an image into one of the divs causes it to go
very weird in firefox. It works fine in Safari.

I would have thought that display:inline; or similar would work for
this, but when I tried that the boxes seemed to lose their boxness.

Hopefully you get some idea of where I'm going with this(!), and any
advice would be appreciated.

A

Jul 24 '07 #1
4 8400
On 24 Jul, 14:12, Adam <kindredhyper...@gmail.comwrote:
I have four roughly square DIVs, all the same height, which I need to
line up horizontally across the page.
Hard to say, without knowing how best they should behave if they
_don't_ fit across the page. Placing each one inside a <tablecell
works, if you really do want a rigid grid behaviour, preserved as much
as possible. Using display:inline; will also work, but as you point
out, they lose "blockiness". display:inline-block; is often the
perfect solution in principal, but support is too narrow to recommend
using it.

Generally the best all-around solution is to use float. Read
http://brainjar.com/css/positioning/ for a good tutorial on how to,
and how to tidy up with clear afterwards. It's not as simple as you
expect, but it's worth studying, at least for an example.

Jul 24 '07 #2
rf

"Adam" <ki*************@gmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
>I have four roughly square DIVs, all the same height, which I need to
line up horizontally across the page. What would be the best way to do
this?
float: left?
At the moment I have a very botched solution where I have
display:table-cell set on each of the DIVs.
IE6 does not support display: table-cell.
I would have thought that display:inline; or similar would work for
this, but when I tried that the boxes seemed to lose their boxness.
A "box" is display: block. If you use display: inline then it is no longer a
"box", it is, er, inline.

display: inline-block is what you are probably looking for but IE6 does not
support this.

--
Richard.
Jul 24 '07 #3
On 2007-07-24, rf <rf@invalid.comwrote:
[...]
>I would have thought that display:inline; or similar would work for
this, but when I tried that the boxes seemed to lose their boxness.

A "box" is display: block. If you use display: inline then it is no longer a
"box", it is, er, inline.
Well, technically the spec does talk of "inline boxes", as opposed to
blocks.
display: inline-block is what you are probably looking for but IE6
does not support this.
Or Firefox.
Jul 24 '07 #4
IE6 does not support display: table-cell.

Interestingly I found that everything started working when I just
added another div with display:table-row; around the boxes. Now it
works in IE6, FF and Safari. How odd...

A

Jul 24 '07 #5

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

Similar topics

3
by: Chris | last post by:
Hi, I am pretty new to CSS authoring and find myself in a tricky situation. I have a series of divs (dynamically generated - there could be up to 8) as follows: <div class="person">...
20
by: Firas D. | last post by:
http://firasd.org/ The divs of the 'box' class seem to have the effect I want in IE (namely: consistent height and horizontal alignment along the set of divs), but it totally falls apart in...
2
by: BenOne© | last post by:
Hi all, I'm trying to create an image gallery with CSS but I can't get the thumbnails to center horizontally as a group. The page, including css defined in the <HEAD> is located at:...
6
by: skeeterbug | last post by:
please check out http://www.geocities.com/operationsengineer1/test2.htm how come there is spacing between my logoheader and the tabs? i'm also seeing ie6 input an extra 1em of vertical...
2
by: Guadala Harry | last post by:
Please follow my thinking here and tell me if I'm nuts or if this is a reasonable thing to do given the objective: I'd like to present 3 data values on an aspx page - each styled uniquely, and...
29
by: eholz1 | last post by:
Hello Styleists! I am trying to get a page going similar to this nice tutorial at A List Apart. URL: http://www.alistapart.com/d/holygrail/example_1.html This is sorta what I would like. ...
6
by: Liam Gibbs | last post by:
Hello everyone, I'm trying to program a church web site and I'm having a number of problems with the layout. The html is at http://www.altmarvel.net/Liam/index.html and the css is at...
4
dlite922
by: dlite922 | last post by:
This is just barely above my head when it comes to css. I have a div that needs to contain rows of floating divs, but I need each row not to wrap on to the next one and continue to go right. The...
7
by: milestogofromhere | last post by:
It is late so this is probably something really obvious but I am not seeing it. Can someone please help? Here is the page in question: html - http://www.itsyourplate.com/index2.php css -...
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...
1
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...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.