Bootstrap 3无序列表显示不正确

时间:2017-10-26 19:09:27

标签: javascript css twitter-bootstrap

我正在为我的班级在Bootstrap 3中创建一个无序列表。我使用glyphicon作为要点。我在桌面视图中的最后一个项目包装有问题,当我在不同的断点中查看时,项目有时会显示为内联。

这是我的HTML

<div class="bg">     
   <div class="container-fluid text-center" style="height:100%;">
     <div class="row content">
   <div class="col-sm-2">     
   </div>
<div class="col-lg-8 text-left"> 
  <h2>EDUCATION</h2>
  <hr class="style1">
  <h3 class="job">Bachelor of Science, Marketing - San Jose State University</h3>
     <h2>CERTIFICATIONS</h2>
  <hr class="style1">
  <h3 class="job">HubSpot Inbound Certification</h3>
  <h4>2016</h4>
   <p>The course details the stages of the inbound methodology. Lectures explained various inbound marketing topcis such as how to optimize websites and best practices for a sucessful landing page.</p>
     <h3 class="job">Coursera Web Design for Everybody</h3>
    <h4>2017</h4>
      <ul class="custom-bullet col-lg-4">
        <li>Introduction to HTML5</li>
        <li>Introduction to CSS3</li>
        <li>Interactivity with JavaScript</li>
        <li>Advanced Styling with Responsive Design</li>
     </ul> 
    </div>  
   </div>
    </div>
   </div>
     <div class="col-sm-2"> 
   </div>

这是我的css:

.bg {
background-color:#ffffff;  
background-size:100%;
width:100%;
height: auto; 
padding-top:8%;
margin-bottom:0;
margin-top:3%;
}
.job {
color: #800080;
}
.custom-bullet li {
display: block;
}
.custom-bullet li:before
{
/*Using a Bootstrap glyphicon as the bullet point*/
content: "\e080";
font-family: 'Glyphicons Halflings';
font-size: 9px;
float: left;
margin-top: 4px;
margin-left: -17px;
color: #000000;
}

2 个答案:

答案 0 :(得分:0)

您将float: left;设置为ul li,这会导致“内联”#39}寻找行为。

在较大的屏幕上使用容器col-lg-4,因此容器较小且某些项目不适合那里并显示在新行上。

您可以重置此项,或根据您的需要调整选择器。

.custom-bullet li
    display: block;
    float: none;
}

答案 1 :(得分:0)

问题在于此课程

.custom-bullet li:before
{
 /*Using a Bootstrap glyphicon as the bullet point*/
 content: "\e080";
 font-family: 'Glyphicons Halflings';
 font-size: 9px;
 float: left; // change to none
 margin-top: 4px;
 margin-left: -17px;
 color: #000000;
}

顺便说一句,为什么你用CSS伪元素添加它而不是用html写。

相关问题