Note that there are some explanatory texts on larger screens.

plurals
  1. POBrowser-specific behavior with %-sized floats. Reasons and solutions?
    primarykey
    data
    text
    <p>I have a series of quadratic divs in a floating environment. Their width is set to 19.5% of the parent element with a margin of .25%. Their 1:1 aspect ratio is ensured by scaling a quadratic image to 100% of the floating div's width:</p> <pre><code>div.item { display: block; position: relative; float: left; width: 19.5%; margin: .25%; } div.item img { display: block; left: 0; bottom: 0; width: 100%; } </code></pre> <p>Now what I get is rows with five floating divs each, spanning the whole width of the parent div.</p> <p>What I would like to do is increase the size of the very first float to cover the same area as 2x2 of the other floats, setting its width to 2*19.5% + 2*.25% = 39.5%.</p> <p>Having done that, testing in two browsers, chromium and firefox, both on Linux. I get different results.</p> <p>Chromium renders the case as expected, one big image with two rows of three divs each on its right side, followed by rows with five divs each.</p> <p>Firefox however displays three rows with only three divs to the right of the big one before having five-item rows. The two items below the big one are effectively missing, just as if the height of it was a little too big (not visibly though). Setting the size of the big one to 39.49% works but while the difference is probably not visible in most cases, it's a pretty dirty hack.</p> <p>Have a look at the testing site here: <a href="http://www.schattensaiten.net/sm62/live" rel="nofollow">http://www.schattensaiten.net/sm62/live</a></p> <p>Any ideas what could be the reason for firefox' behavior and how to get around this problem?</p> <p>EDIT: I just finally found a firefox window-size where it does look correct, so it probably has something to do with rounding errors when scaling the images by percentage. I have so far not found a case where it was not working in Chrome, so Chrome seems to be more forgiving about that. Still, I'd be highly interested in a working solution that does not force me to give up my approach of the site dynamically adjusting to use the full browser size. I hate fixed-width layouts. I want to present my images as large as I can on any given screen.</p>
    singulars
    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