Jim
Jim

Reputation: 14270

Why does PureCSS stack grid divs in Firefox?

I'm attempting to create a grid using PureCSS and have discovered a behavior I don't understand. I want the left part of the grid to take up 1/3 of the page and the right the remaining 2/3:

# index.html
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test PureCSS</title>
    <link rel="stylesheet" href="http://yui-s.yahooapis.com/pure/0.6.0/pure-min.css">    
    <link rel="stylesheet" href="http://yui-s.yahooapis.com/pure/0.6.0/grids-responsive-min.css">
    <link rel="stylesheet" href="css/base.css">
</head>
<body>
    <div class="header">
        <div class="home-menu pure-menu pure-menu-horizontal">
            <a class="pure-menu-heading" href="#">Test Page</a>
            <ul class="pure-menu-list">
                <li class="pure-menu-item pure-menu-selected"><a href="#" class="pure-menu-link">Home</a></li>
                <li class="pure-menu-item"><a href="#" class="pure-menu-link">Tour</a></li>
                <li class="pure-menu-item"><a href="#" class="pure-menu-link">Sign Up</a></li>
            </ul>
        </div>
    </div>
    <div class="pure-g">
        <div class="l-box-lrg pure-u-1 pure-u-md-1-3">
            <div class="content-wrapper">
                <div class="content">
                    1-3
                </div>
            </div>
        </div>
        <div class="l-box-lrg pure-u-1 pure-u-md-2-3">
            <div class="content-wrapper">
                <div class="content">
                    2-3
                </div>
            </div>
        </div>
    </div>
</body>
</html>

Here's the CSS:

# base.css
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
.home-menu {
    padding: 0.5em;
    text-align: center;
    box-shadow: 0 1px 1px rgba(0,0,0, 0.10);
}
.l-box-lrg {
    padding: 2em;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.content-wrapper {
    /* These styles are required for the "scroll-over" effect */
    position: absolute;
    top: 87%;
    width: 100%;
    min-height: 12%;
    z-index: 2;
    background: white;

}
@media (min-width: 48em) {
    .content {
        padding: 1em;
    }
}

In Chrome, which uses Blink, this page renders as expected. But in Firefox, which is Gecko-based, the left 1-3 div gets stacked on top of the right 2-3 div. In the past, problems like this were caused by having a space at the end of a div. However, I've checked my code and it doesn't have any extra spaces. I read somewhere about how these rendering engines handle display:block versus display:inline-block differently so maybe that has something to do with it. But I would think that if PureCSS was developed by Yahoo, they would have factored any rendering engine differences into their framework so that this wouldn't happen.

Upvotes: 0

Views: 243

Answers (1)

Most probably its because of the user agent stylesheet try and check if the body doesnt have padding or margin applied to it

Upvotes: 0

Related Questions