高度:自动在div中不起作用

时间:2018-07-20 10:55:02

标签: html css

我想用height:auto;

enter image description here

但是height:auto不起作用

如果我在whoweare css内部设置height:auto,就像这样;

enter image description here

我应该设置height:auto,如何解决这个问题?

<div class="whoweare">
   <div class = "one-forth">
    <div style="background-image: url(img/puzzle.png)"></div>
    <h3>Profesyonel Çözümler</h3>
    <p class="text-top-reduced">20 yılı aşkın sektör tecrübesiyle Profert size en iyi çözümleri sunar.</p>
</div>

.whoweare{
  width: 70%;
  height: auto;
  background-color: red;
  margin: auto;
  display: block;
}

.one-forth{
  width: 20%;
  height: auto;
  float: left;
  text-align: center;
  margin-left:5%;
  margin-top: 30px;
  background: #F8F8F8;
  border-radius: 10px;
}

.one-forth p{
  margin-top:10px;
  font-size:100%;
  margin-bottom: 10px;

}
.one-forth div{
  width: 70px;
  height:70px;
  margin: auto;
  margin-bottom: 10px;
  margin-top:10px;
  background-size: 100% 100%;  
}

0 个答案:

没有答案