Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am unsure what your ultimate goal is here, but I would suggest enclosing all four <code>&lt;div&gt;</code>s inside a container element and applying a width to it, then removing the <code>clear</code> style from <code>#divthree</code>. Doing it this way will allow <code>#divthree</code> and <code>#divfour</code> to move below <code>#divone</code> and <code>#divtwo</code> without clearing them:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;IE Float Test&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt; &lt;style type="text/css"&gt; #divone, #divtwo, #divthree, #divfour { width: 100px; height: 100px; color: white; font-size: 3em; float: left; } #divone { background-color: red; } #divtwo { background-color: blue; } #divthree { background-color: green; } #divfour { background-color: purple; } #container { width: 200px; zoom: 1; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;div id="divone"&gt;one&lt;/div&gt; &lt;div id="divtwo"&gt;two&lt;/div&gt; &lt;div id="divthree"&gt;three&lt;/div&gt; &lt;div id="divfour"&gt;four&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The <code>zoom</code> property on <code>#container</code> is necessary to avoid the <a href="http://www.positioniseverything.net/explorer/escape-floats.html" rel="nofollow noreferrer">IE6/7 Escaping Floats Bug</a>.</p> <p>If the above solution isn't viable, you can add a <code>&lt;br&gt;</code> or <code>&lt;div&gt;</code> after <code>#divtwo</code> with the style <code>clear: left;</code>:</p> <pre><code>&lt;div id="divone"&gt;one&lt;/div&gt; &lt;div id="divtwo"&gt;two&lt;/div&gt; &lt;br style="clear: left;" /&gt; &lt;div id="divthree"&gt;three&lt;/div&gt; &lt;div id="divfour"&gt;four&lt;/div&gt; </code></pre> <p>This is the technique used in <a href="http://www.westciv.com/style_master/house/tutorials/quick/floated_layout/index.html" rel="nofollow noreferrer">a floated page layout example on westciv.com</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload