Reputation: 21
A site I'm preparing is about 150% width of the viewport. I have checked the site and no element appears to be wider than the viewport. The problem occurs only in IE 10+ and Edge; earlier versions of IE or other browsers display everything fine.
I have found out that:
if I delete line 29 of the CSS (on CodePen) declaring width of .branding-wrapper
the site is the correct size (but the .branding-wrapper must be as wide as the viewport. Changing width to 100vw does not result in any change.
if I delete the media queries and line 9 of the CSS (justify-content:center) the site is the correct size (but the image must be centered)
.test {
width: 100%;
min-height: 400px;
background-color: red;
margin-top: calc(100vh);
}
.header {
display: flex;
justify-content: center;
}
.header-img {
width: 2000px;
position: fixed;
top: 0;
z-index: -2;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
.header-img{
transform: translateX(-50%);
}
.branding-wrapper {
transform: translateX(-50%);
}
}
.branding-wrapper {
height: 350px;
width: 100%;
position: absolute;
bottom: 0px;
background: blue;
}
<body class="home blog">
<div class="header">
<img src="image link" alt="test" class="header-img">
<div class="branding-wrapper ">
text
</div>
</div>
<div class="test"></div>
The problem can be seen here: https://codepen.io/mateuszcora/pen/WdOQMr
Upvotes: 1
Views: 556
Reputation: 21
Fixed the issue by centering the image another way in IE
.header {
justify-content:center;
display:flex;
}
// margin-bottom:-52px;
}
.header-img {
min-height: 100vh;
position: fixed;
top: 0;
z-index: -2;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS styles go here */
.header-img {
transform:translateX(-50%);
margin:0 auto;
}
.header{
display:unset;
justify-content:unset;
}
Upvotes: 1