有人知道如何获得img工作的最大宽度的解决方案吗?
https://jsfiddle.net/16601v4s/
<div class="row">
<div class="cell-content">
hier komt de tekst met één of meer afbeeldingen<br>
<img src="http://www.clker.com/cliparts/d/3/4/8/122620237858385735ivak_TV_Test_Screen.svg" width="800" border="0" alt="" />
</div>
</div>
我的CSS:
.row {
height:100%;
width: 100%;
display:table-row;
}
.cell-content {
max-width: 100%;
margin: 1%;
}
.cell-content img {
max-width: 90% !important;
height: auto !important;
}
答案 0 :(得分:0)
你有(在你的js小提琴上,而不是上面的代码)
.cell-content {
width: 100px;
margin: 1%;
}
将其更改为
.cell-content {
width: 100%; //Or whatever width you need
margin: 1%;
}
答案 1 :(得分:0)
图像的最大宽度取决于父容器。只需删除父容器宽度
即可.cell-content { margin: 1%; }
答案 2 :(得分:0)
工作正常
.cell-content
的宽度减少到100px
和
.cell-content img
max-width
尝试继承除100px
之外的父母,并使用90%
90px
因此,如果您需要为
img
设置更大的宽度,请不要为其父级设置宽度
答案 3 :(得分:0)