如何对齐文本列的图像宽度和高度?我使用相对位置,但它不起作用。
.bungkus-komentar {
position: relative;
background: blue;
min-height: 100px;
}
.div-komentar {
width: 85%;
float: left;
overflow: hidden;
background: green;
}
.div-penjawab {
background: yellow;
margin: 1px;
padding: 1px;
width: 10%;
height: 50px;
float: left;
}
.div-penjawab img {}
<div class="bungkus-komentar">
<div class="div-komentar">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</div>
<div class="div-penjawab">
<img class="img-circle" src="http://bakerhi.com/wp-content/themes/nucleare-pro/images/no-image-box.png" width='100%' height='100%'>
</div>
</div>
最佳答案
类似的东西?
.bungkus-komentar {
display:flex;
background: blue;
min-height: 100px;
margin-bottom:5px;
}
.div-komentar{
width: 85%;
float: left;
overflow:hidden;
background:green;
}
.div-penjawab {
background: yellow;
margin :1px;
padding:1px;
width: 10%;
height: 50px;
float: left;
}
.div-penjawab img {
}
<div class="bungkus-komentar">
<div class="div-komentar">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</div>
<div class="div-penjawab">
<img class="img-circle" src="http://bakerhi.com/wp-content/themes/nucleare-pro/images/no-image-box.png" width='100%' height='100%'>
</div>
</div>
<div class="bungkus-komentar">
<div class="div-komentar">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</div>
<div class="div-penjawab">
<img class="img-circle" src="http://bakerhi.com/wp-content/themes/nucleare-pro/images/no-image-box.png" width='100%' height='100%'>
</div>
</div>
<div class="bungkus-komentar">
<div class="div-komentar">Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum Lorem Ipsum</div>
<div class="div-penjawab">
<img class="img-circle" src="http://bakerhi.com/wp-content/themes/nucleare-pro/images/no-image-box.png" width='100%' height='100%'>
</div>
</div>
关于html - html中的CSS定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39890862/