No newline after div?

Is there a way to not have a newline inserted before a div without using float: left on the previous element?

Maybe some tag on the div that will just put it to the right?


Solution 1:

There is no newline, just the div is a block element.

You can make the div inline by adding display: inline, which may be what you want.

Solution 2:

Have you considered using span instead of div? It is the in-line version of div.

Solution 3:

<div style="display: inline">Is this what you meant?</div>

Solution 4:

Quoting Mr Initial Man from here:

Instead of this:

<div id="Top" class="info"></div><a href="#" class="a_info"></a>

Use this:

<span id="Top" class="info"></span><a href="#" class="a_info"></a>

Also, you could use this:

<div id="Top" class="info"><a href="#" class="a_info"></a></div>

And gostbustaz:

If you absoultely must use a <div>, you can set

div {
    display: inline;
}

in your stylesheet.

Of course, that essentially makes the <div> a <span>.