如何使div中的所有元素保持一行

时间:2018-08-28 15:43:35

标签: html css

我试图使所有元素都保持一行。这是代码

.logoHeader{
    width:10vw;
    display:inline;
}

ul li{
    display: inline-flex;
}


span{
  font-size:0.5em;
}

.myClass {
  display: inline-flex;
}
<div class="myClass"><img class="logoHeader" src="https://s.imgur.com/desktop-assets/desktop-assets/Navbar-logo.bcf646386406b43008da913e901b916d.svg" width="500" height="53" alt="">
<ul>
<li><h5><span>A</span>Put Iva Vizina 165</h5></li>
<li><h5><span>T</span>T +382 69 710 025</h5></li>
<li><h5><span>Random Crap</span> Plaforma, 2018</h5></li>
</ul>
</div>

所以我需要整个列表项与徽标一起对齐

1 个答案:

答案 0 :(得分:1)

align-item: center元素上使用.myClass

.logoHeader {
  width: 10vw;
  display: inline;
}

ul li {
  display: inline-flex;
}

span {
  font-size: 0.5em;
}

.myClass {
  display: inline-flex;
  align-items: center;
}
<div class="myClass"><img class="logoHeader" src="https://s.imgur.com/desktop-assets/desktop-assets/Navbar-logo.bcf646386406b43008da913e901b916d.svg" width="500" height="53" alt="">
  <ul>
    <li>
      <h5><span>A</span>Put Iva Vizina 165</h5>
    </li>
    <li>
      <h5><span>T</span>T +382 69 710 025</h5>
    </li>
    <li>
      <h5><span>Random Crap</span> Plaforma, 2018</h5>
    </li>
  </ul>
</div>