How does one place multiple divs next to one another without causing break line?


I want to have multiple divs next to one another, without them breaking into a new line, but all staying in same line.

<div class=“name_lable”>User name:</div> <div class=“name_form”>John Doe</div>

How does one do this?

And just to make sure: your suggestion should also work on IE.


the MOST basic way is to use FLOAT

you can float:left or float:right.
floats remove the element from the normal flow and shrink wrap it ( so you might need to specify a width along with your float declaration. You will also want to clear the floats. By far the BEST WAY is to give overflow:hidden; to the parent element.

Another way… is to make give your elements display:inline-block. you will probably want to add -moz-inline-box in your rules for OLD Firefox.

Hope that helps


It is not working.
You can see a sample page here:

Check out the section at bottom of page labeled: More details about me
Those Label Value pairs should be in the same line, but they are not!

I also tried display:inline-block, and it was even worst

Check your widths as they are greater than the space available.

Just add a background colour and you will see that they overlap.:slight_smile:

I can’t even find in your page where you’re trying to do that – but to be brutally frank placing a couple of DIV are the least of your issues with the horde of outdated 1990’s style HTML! Tables for layout, tags like FONT and CENTER that have zero business on a website written after 1998, use of bold tags on what should probably be headings, use of bold tags on what should be DT’s… that’s how you end up with 16k of HTML for 2.7k of content – basically two or three times as much code as should be necessary… hence the 127 validation errors meaning you don’t even have HTML, you have gibberish.

Even simple things like the attempt to use italics inside TITLE – which can only contain CDATA – are an indication the whole thing needs to be thrown away and redone from scratch as there’s nothing there I’d even TRY to save, much less deploy.