Note that there are some explanatory texts on larger screens.

plurals
  1. POFloat mistake in arbitrary-width div positioned absolutely
    primarykey
    data
    text
    <p>again a problem with IE browsers version 6 and 7</p> <p>Take a look at an example right away, try resizing the window and such.</p> <p><a href="http://fiddle.jshell.net/BXfNJ/10/show/" rel="nofollow">a preview (easier to open in IE this way)</a></p> <p><a href="http://jsfiddle.net/BXfNJ/10/" rel="nofollow">code</a></p> <p>HTML:</p> <pre><code>&lt;div class="container"&gt; &lt;div class="left-menu"&gt; &lt;ul&gt; &lt;li&gt;El1&lt;/li&gt; &lt;li&gt;Element 2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div style="margin-right: 60px;"&gt;Тест Тест&lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>.container{ position:absolute; top:100px; left:100px; outline: 1px solid red; background-color:pink; } .left-menu{ outline: 1px solid green; background-color:#AAA; width: 50px; float: right; } </code></pre> <p>Now I don't understand 2 things</p> <ol> <li><p>What happens to the float element? the box is never too small, infact the margin of the adjacent div is bigger than the width of ul div. But when the window is small enough the float element appears to be floating to the window edge not its container edge, but if you scroll a little to the right when the window is small you will see the container is wide enough.</p></li> <li><p>Less important issue why is it this wide? Shouldn't it be as wide as it's contents? </p></li> </ol> <p>The only fix I've come up with is to give my absolute div a width, but there is the problem. It should resize with the contents say if there is a picture near the float div.</p> <p>And there will be a picture =) This width workaround of course allows to use tons of javascript, to resize every element in the more complex structure than shown in the example, but i wonder may css be used instead?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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