【发布时间】:2017-11-18 07:50:51
【问题描述】:
您好我已经参考了这个问题并尝试了它的答案Flexbox Not Centering Vertically in IE
但是我的按钮仍然不会在 IE 中居中,它适用于所有其他浏览器。
这里是 HTML
<div class="captioned-video">
<div class="video-container" data-module-dynamic="embed-video">
<img src="img here"/>
<button class="play" data-video="video url here"></button>
</div>
<div class="caption">
<h3 class="caption__subhead">Caption Headline</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div>
还有我的少
.captioned-video {
border: 1px solid @light-slate;
padding: 20px;
display: flex;
flex-direction: column;
.video-container {
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
position: relative;
img {
flex: none;
}
iframe /*iframe is here because on btn click the img is swapped to this*/{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.play {
width: 100px;
height: 100px;
border-radius: 100%;
border: none;
background-color: rgba(200, 81, 8, 0.8);
position: absolute;
padding: 0;
&:hover {
transition: all ease 0.5s;
background-color: rgba(200, 81, 8, 1);
}
&:after {
content: "";
position: relative;
display: inline-block;
border-style: solid;
border-width: 20px 0 20px 30px;
border-color: transparent transparent transparent white;
top: 2px;
left: 5px
}
}
}
.caption {
.caption__subhead {
color: @royal-blue;
font-family: @headings-font-family;
font-size: 14px;
}
p {
font-size: 12px;
font-style: @font-family-sans-serif;
}
}
}
如果我在 ie ii 中检查按钮上的元素不可见但元素突出显示它似乎在图像下方,我错过了什么,可能是定位问题?
【问题讨论】:
-
为了更好的帮助,发布编译后的代码,这样更容易重现问题。不是每个人都使用 CSS 预处理器。
-
你说的是哪个版本的IE? IE9 及以下不支持 flexbox。 IE 10 及更高版本支持有限版本的 flexbox。
-
@Terry IE11,我需要一个快速修复,所以我只做了 top / bottom / left / right : 0 和 margin auto 但我想知道为什么 flexbox 不能在那里工作。
-
欺骗链接建议 Safari,尽管它与我下面的 wiki 答案中的解决方案相同。
标签: html css internet-explorer flexbox