我在引导程序中有一个4 div块。我需要使它们彼此更紧密地靠近,但是我不能这样做:
这是CSS:

.cnt {
  height: 1067px;
  padding:20px;
  margin-top:20px;
  margin-bottom:10px;
  background: rgba(255, 255, 255, .5);
  overflow:hidden;
  box-shadow: 0 10px 90px rgba(0, 0, 0, 0.4);
}

@media only screen and (min-width : 480px) {
  .cnt {
    height: auto;
  }
}

@media only screen and (min-width : 768px) {
  .cnt {
    width: 471px;
    height: 452px;
    padding: 30px;
  }
}

@media all and (max-width: 1170px) {
    .cnt {
        height: 380px;
    }
}


这是HTML:

<div class="col-md-6  col-xs-12">
      <div class="cnt"><img class="feature-icon" src="images/contract.svg"><br>
        <br><br><b>Strategic<br>Planning</b><br><br>
        Strategic Planning projects help our clients to make
        decisions and take actions that match their company’s
        skills.</div>
    </div>
    <div class="col-md-6 col-xs-12">
      <div class="cnt"><img class="feature-icon" src="images/analytics.svg"><br>
      <br><br><b>Market research</b><br><b>Partner Search</b><br><br>
        Our aim is to build a long-term and positive relationship
        with our clients and to contribute to business owners’
        confidence. </div>
    </div>

    <div class="col-md-6  col-xs-12">
      <div class="cnt"><img class="feature-icon" src="images/weight-balance.svg"><br>
        <br><br><b>Coaching</b>
        <br><br><br><br>Coaching focuses on future possibilities, not past
        mistakes… Coaching thinks of the people in terms
        of their potential, not their performance.</div>
    </div>
    <div class="col-md-6 col-xs-12">
      <div class="cnt"><img class="feature-icon" src="images/idea.svg"><br>
      <br><br><b>Project</b><br><b>Management</b><br>
       <br>An engagement with an objective, start and end date,
        aimed to create a product or service may be considered
        a project.</div>
    </div>


我尝试对每个块使用float:leftdisplay: inline-block,但id并没有帮助我。我该如何解决?

最佳答案

我认为您需要将类添加到您的<div class="col-md-6 col-xs-12">元素,并添加自定义CSS,如下所示:

.inline {  display:inline-block; }

关于html - 彼此移位,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54820098/

10-12 06:53