473,397 Members | 2,077 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,397 software developers and data experts.

Showing divs side by side

What would be the best way to make four roughly square divs line up in
a horizontal row on a page? I've tried display:inline; with no luck
(it just destroyed the box shape) and at the moment I've got a very
messy solution with display:table-cell - I had to put   between
each div as margin had no effect.

Any ideas? Greatly appreciated.

A

Jul 19 '07 #1
3 5769
On 2007-07-19, Adam <ki*************@gmail.comwrote:
What would be the best way to make four roughly square divs line up in
a horizontal row on a page? I've tried display:inline; with no luck
(it just destroyed the box shape) and at the moment I've got a very
messy solution with display:table-cell - I had to put &nbsp; between
each div as margin had no effect.

Any ideas? Greatly appreciated.
Make them float: left.

display: inline-block would be ideal, but is not widely supported.
Jul 19 '07 #2
Well bust mah britches and call me cheeky, on Thu, 19 Jul 2007 21:02:24 GMT
Adam scribed:
What would be the best way to make four roughly square divs line up in
a horizontal row on a page? I've tried display:inline; with no luck
(it just destroyed the box shape) and at the moment I've got a very
messy solution with display:table-cell - I had to put &nbsp; between
each div as margin had no effect.

Any ideas? Greatly appreciated.
As Ben C said, floats are the answer. But read-up on "clear" for what
follows.

--
Neredbojias
A self-made man who worships his creator
Jul 20 '07 #3
On 19 Jul, 22:02, Adam <kindredhyper...@gmail.comwrote:
Any ideas? Greatly appreciated.
Use float

Read http://brainjar.com/css/positioning/ for a guide to the gory
details. It's easy to put the <div>s where you want, getting things to
sort themselves out afterwards (with clear) needs a bit more digging.

Jul 20 '07 #4

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

Similar topics

12
by: Michael Ramey | last post by:
Hi, I've have two divs, that are laid out side-by-side. (I'm floating the first div to the left) I need to set up css on these two divs so that the second div is vertically aligned to the...
4
by: Aaron | last post by:
I have the following divs: <div style="background-image: url(images/house_01.jpg); width: 249px; height: 346px;"></div> <div style="background-image: url(images/house_02.jpg); width: 251px;...
15
by: red | last post by:
How do I center two side by side divs ? I've been writing css pages for a while but there's one thing tha still eludes me. I can center a div with margin auto. I can place two divs side by side...
5
by: squidco | last post by:
I've been trying to wean myself off of tables. I've been reading about the float property, and have implemented a couple of sites using divs instead of tables, and generally I'm happy with the...
6
by: Mel | last post by:
i need to have as many as 5 divs side by side on the same line without a break. if browser displays a horizontal scrollbar, its ok with my users and they can resize it. something like the...
5
by: gregmercer | last post by:
I have the following html sample, where I'd like to have a show and hide two divs, one replacing the other. Following these two divs is a third div (the bluediv) which I would like to have placed...
5
by: Mike P | last post by:
How would I show or hide a div that is using client side Javascript based upon a server side variable? Here are my divs : <div id="idButton5" class="otherLeftBarLink" onmouseover="javascript:...
3
jhardman
by: jhardman | last post by:
I'm almost to the point of using tables to position my elements. That is how bad this is. So here's the rundown. I have an old page (created by someone else) that I was trying to update to...
2
by: jeddiki | last post by:
How do I get these 2 divs to be side by side ? I have been trying to apply the float logic to a couple of divs on the same screen, but without success. There is a main div that holds two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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,...

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.