html - html中的CSS定位

标签 html css

如何对齐文本列的图像宽度和高度?我使用相对位置,但它不起作用。

enter image description here

.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/

相关文章:

html - 将 HTML 注入(inject)另一个页面而不发生 CSS 冲突

javascript - 切换多个图像并将它们设置为背景

html - CSS Hover 以不同方式控制多个元素

html - 为什么我的文本只有在大部分内容绘制在元素之外后才会换行?

html - 更改了我的 div 的宽度,现在居中消失了

javascript - PHP乘法和减法脚本

html - 我如何获得 `HTML > Body > Background-Color > Transparent` ?

css - 为什么我的社交媒体图标/按钮是环绕的?

javascript - 按钮-如何将一个按钮移到另一个按钮的右侧

javascript - 固定背景附件 CSS/XHTML/jQuery