Reputation: 559
I am using a simple layout with three 100% width and height sections. They work as intended in Firefox and IE, but not in Chrome.
Here is the code that I use:
html,body{width: 100%;height: 100%;}
section{width: 100%;height: 100%;}
.section-bg{width: 100%;height: 100%;}
.section-bg is a div that should hold the content. Here is the link to live example if anyone is interested.
Also, I forgot to mention that by inspecting with chrome tools, it seems that the height of auto is applied to the html element. Of course setting this to 100% , makes everything fine in Chrome.
Upvotes: 1
Views: 4921
Reputation: 121
That is registered Chrome bug. My workaround is to use flexbox next way:
body{
display: flex;
flex-direction: column;
}
section {
flex:1 0 0px;
}
and worckaround for webkit:
@media all and (-webkit-min-device-pixel-ratio:0) { /* ...write webkit styles here*/ }
Upvotes: 1
Reputation: 3295
You said that chrome is overriding your CSS right?
So use:
html,body{
width: 100% !important;
height: 100% !important;
}
section{
width: 100% !important;
height: 100% !important;
}
.section-bg{
width: 100% !important;
height: 100% !important;
}
To make sure that browsers will not override your CSS.
Upvotes: 1