简体   繁体   中英

Bootstrap 3 Unordered list displaying incorrectly

I am creating a unordered list in Bootstrap 3 for my class. I am using a glyphicon as the bullet point. I am having trouble with the last item wrapping in desktop view and as I view it in different breakpoints the items sometimes display inline.

Here is my 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>

Here is my 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;
}

You are setting float: left; to the ul li , that causes the 'inline' looking behavior.

On larger screen use have container with col-lg-4 , so the container is smaller and some items do not fit there and appears on new line.

You can reset this, or adjust the selector, depends on what you want.

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

The problem is with this class

.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;
}

By the way why did you add this as with CSS pseudo-elements rather than writing in html.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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