Internet Explorer 上的最大宽度
Max-width on Internet Explorer
我无法让 max-width 在 IE 中工作。有没有办法让 max-width 在 IE 上工作?
这是它在其他浏览器上的样子:
enter image description here
这是它在 IE 上的样子:
enter image description here
这里是 HTML 代码
<div class="grid menu-content" id="menu1-content">
<article>
<div class="photo" style="background-image: url(img/test.jpg);">
</div>
<div class="text">
<div class="company-name">Name</div>
<div class="company-description">Basdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="sdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">name</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/breadfinance-founder.jpg" alt="Bread Finance Founder JOSH ABRAMOWITZ
"></div>
<div class="name">BEN JIN
</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">KATIE KIM</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdfasdf"></div>
<div class="name">DEBBIE KIM</div>
</div>
</div>
</article>
</div>
这里是CSS
.name {
font-size: 12px;
letter-spacing: 2.2px;
margin-left: 17px;
}
.founder img {
width: 22px;
}
.founder {
margin-bottom: -5px;
}
article .picture {
max-width: 22px;
}
.
.company-name {
margin-top: 20px;
margin-bottom: 1px;
font-size: 22.5px;
}
.company-description {
font-size: 21px;
line-height: 1.8;
letter-spacing: 0.5px;
margin-bottom: 6px ;
}
.founders {
position: absolute;
}
.founder {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin, padding: 0px;
}
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
line-height: 1.6;
}
.picture {
-webkit-box-flex: 0;
-ms-flex: 0 0 22px;
flex: 0 0 22px;
margin: 0;
}
.founder img {
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.founders {
top: 99%;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS */
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
}
还有一些 css 可能不相关
.grid {
display: -ms-flexbox;
-ms-flex-wrap: wrap;
display: grid;
-webkit-box-pack: start;
justify-content: start;
justify-content: space-between;
row-gap: 100px;
}
.grid article {
-ms-flex: 0 0 250px;
-ms-flex-pack: start;
}
.grid .photo {
width: 100%;
background-size: contain;
background-position: center;
}
.grid .photo:after {
content: "";
display: block;
padding-bottom: 100%;
}
.grid a {
display: block;
text-decoration: none;
color: inherit;
}
.grid article {
position: relative;
}
.grid {
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
grid-row-gap: 100px;
grid-column-gap: 50px;
}
看起来您已经为您之前要求的 创建了这个新线程。
我测试了示例代码,发现 .name
class 中的 -ms-flex: 1; and flex: 1;
导致了这个问题。
由于一些已知问题,IE 11 部分支持 Flex。这可能是导致此问题的一个可能原因。
可以通过评论或从 .name
class 中删除 flex 来解决此问题。
.姓名class:
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
/*-ms-flex: 1;
flex: 1;*/
line-height: 1.6;
}
输出:
我无法让 max-width 在 IE 中工作。有没有办法让 max-width 在 IE 上工作?
这是它在其他浏览器上的样子: enter image description here
这是它在 IE 上的样子:
enter image description here
这里是 HTML 代码
<div class="grid menu-content" id="menu1-content">
<article>
<div class="photo" style="background-image: url(img/test.jpg);">
</div>
<div class="text">
<div class="company-name">Name</div>
<div class="company-description">Basdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="sdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">name</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/breadfinance-founder.jpg" alt="Bread Finance Founder JOSH ABRAMOWITZ
"></div>
<div class="name">BEN JIN
</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">KATIE KIM</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdfasdf"></div>
<div class="name">DEBBIE KIM</div>
</div>
</div>
</article>
</div>
这里是CSS
.name {
font-size: 12px;
letter-spacing: 2.2px;
margin-left: 17px;
}
.founder img {
width: 22px;
}
.founder {
margin-bottom: -5px;
}
article .picture {
max-width: 22px;
}
.
.company-name {
margin-top: 20px;
margin-bottom: 1px;
font-size: 22.5px;
}
.company-description {
font-size: 21px;
line-height: 1.8;
letter-spacing: 0.5px;
margin-bottom: 6px ;
}
.founders {
position: absolute;
}
.founder {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin, padding: 0px;
}
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
line-height: 1.6;
}
.picture {
-webkit-box-flex: 0;
-ms-flex: 0 0 22px;
flex: 0 0 22px;
margin: 0;
}
.founder img {
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.founders {
top: 99%;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS */
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
}
还有一些 css 可能不相关
.grid {
display: -ms-flexbox;
-ms-flex-wrap: wrap;
display: grid;
-webkit-box-pack: start;
justify-content: start;
justify-content: space-between;
row-gap: 100px;
}
.grid article {
-ms-flex: 0 0 250px;
-ms-flex-pack: start;
}
.grid .photo {
width: 100%;
background-size: contain;
background-position: center;
}
.grid .photo:after {
content: "";
display: block;
padding-bottom: 100%;
}
.grid a {
display: block;
text-decoration: none;
color: inherit;
}
.grid article {
position: relative;
}
.grid {
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
grid-row-gap: 100px;
grid-column-gap: 50px;
}
看起来您已经为您之前要求的
我测试了示例代码,发现 .name
class 中的 -ms-flex: 1; and flex: 1;
导致了这个问题。
由于一些已知问题,IE 11 部分支持 Flex。这可能是导致此问题的一个可能原因。
可以通过评论或从 .name
class 中删除 flex 来解决此问题。
.姓名class:
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
/*-ms-flex: 1;
flex: 1;*/
line-height: 1.6;
}
输出: