简体   繁体   English

如何将Li与Boostrap并排对齐3

[英]How to align li side by side with boostrap 3

I would like to have my icon <i> and my text <h3><p> side by side, and not one on top of the other. 我想让我的图标<i>和文本<h3><p>并排放置,而不是一个放在另一个顶部。 I have been trying float:left; 我一直在尝试float:left; and display:inline-block; display:inline-block; but nothing works... 但是什么都行不通...

Help anyone? 帮助任何人? Thanks a lot. 非常感谢。

My HTML 我的HTML

<div class="steps">
 <div class="container">
  <div class="row">
   <div class="col-xs-12 col-sm-4">
    <ul class="step">
     <li><i class="fa fa-question fa-4x"></i></li>
     <li><h3>Ask</h3><p>Talk 1-on-1 with caring professionals who are online and ready to help you now.</p></li>
    </ul>
   </div>
  </div>
 </div>
</div>

My CSS 我的CSS

.steps ul li {
display:inline-block;
float:left;}
.step li {
  display: table; 
}

.step li:first-child {
  float: left;    
}

Demo link 演示链接

You have to put the class selector next to the ul. 您必须将类选择器放在ul旁边。

ul.steps li {
    display: inline-block;
    float: left;
}

View in a browser's style sheet viewer (F12 on most modern browsers) and make sure these styles aren't being out trumped by a bootstrap style. 在浏览器的样式表查看器中查看(在大多数现代浏览器中为F12),并确保这些样式不会被引导样式所取代。 If it is you will have to make this more specific, for example add a class to li and then add that to your css selector. 如果是这样,则必须对此进行更具体的说明,例如,将一个类添加到li中,然后将其添加到您的css选择器中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM