skip to Main Content

I have created a colorful box using bootstrap. I want to add a horizontal line which goes from left to right as shown in second picture. I try to add new div having border in button but it did not fit in whole width of box.

enter image description here

Fig: Image with border not fit in right container

enter image description here

Fig: Expected fit border in container

Here is my code.

.row-eq-height {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  flex-wrap: wrap;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet" />
<br>
<br>
<div class="container" style="color:white;">
  <div>
    <div class="row row-eq-height">
      <div class="col-lg-5 col-md-5">
        <div class="row row-eq-height">
          <div class="col-md-4 col-lg-4" style="background-color:darkorange;padding:15px; text-align:center;">
            <div><i class="fa fa-book fa-5x"></i></div>
            <div style="color:white;font-size:large;">Grades</div>
          </div>
          <div class="col-md-8 col-lg-8" style="background-color:#FFB964; font-weight:bold; ">

            <div class="col-md-12 col-lg-12">
              <span style="font-size:48px;color:silver;">0</span>
              <span style="font-size:large;">New Grades</span>
            </div>
            <div class="col-md-12" style="border-bottom:1px solid red; "></div>
            <div class="col-md-12 col-lg-12" style="padding:5px;">
              <span style="float:left;">Last Grade: 100</span> <span style="float:right;">Date: 3/26</span>
            </div>
            <div class="col-md-12 col-lg-12" style="padding:5px;">
              <span style="float:left;">Name: Animal Thumbnail</span>
            </div>
          </div>
        </div>

      </div>
      <div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2">
        <div class="row row-eq-height">
          <div class="col-md-4 col-lg-4" style="background-color:deepskyblue;padding:15px; text-align:center;">
            <div><i class="fa fa-pencil fa-5x"></i></div>
            <div style="color:white;font-size:large;">Grades</div>
          </div>
          <div class="col-md-8 col-lg-8" style="background-color:#5BD4FC; font-weight:bold; ">
            <div class="col-md-12 col-lg-12">
              <span style="font-size:48px;color:silver;padding:10px;">0</span>
              <span style="font-size:large;">New Assignments</span>
            </div>
            <div class="col-md-12" style="border-bottom:1px solid red; "></div>

          </div>
        </div>
      </div>
    </div>
  </div>
  <div style="padding-top:50px;">
    <div class="row row-eq-height">
      <div class="col-lg-5 col-md-5">
        <div class="row row-eq-height">
          <div class="col-md-4 col-lg-4" style="background-color:rebeccapurple;padding:15px; text-align:center;">
            <div><i class="fa fa-check-square-o fa-5x"></i></div>
            <div style="color:white;font-size:large;">Grades</div>
          </div>
          <div class="col-md-8 col-lg-8" style="background-color:#8F59FF; font-weight:bold; ">
            <div class="col-md-12 col-lg-12">
              <span style="font-size:48px;color:silver;padding:10px;">0</span>
              <span style="font-size:large;">New Postings</span>
            </div>
            <div class="col-md-12" style="border-bottom:1px solid red; "></div>
            <div class="col-md-12 col-lg-12" style="padding:5px;">
              <span style="float:left;">Last Abs Per: 07</span> <span style="float:right;">Date: 3/26</span>
            </div>
            <div class="col-md-12 col-lg-12" style="padding:5px;">
              <span style="float:left;">Name: Absent-Unexcused</span>
            </div>
          </div>
        </div>

      </div>
      <div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2">
        <div class="row row-eq-height">
          <div class="col-md-4 col-lg-4" style="background-color:crimson;padding:15px; text-align:center;">
            <div><i class="fa fa-comment-o fa-5x"></i></div>
            <div style="color:white;font-size:large;">Messages</div>
          </div>
          <div class="col-md-8 col-lg-8" style="background-color:#F16A85; font-weight:bold; ">
            <div class="col-md-12 col-lg-12">
              <span style="font-size:48px;color:silver;padding:10px;">0</span>
              <span style="font-size:large;">New Messages</span>
            </div>
            <div class="col-md-12" style="border-bottom:1px solid red; "></div>

          </div>
        </div>
      </div>
    </div>
  </div>

</div>

https://codepen.io/anon/pen/ZPNepV

My border is not fit in right container.

<div class="col-md-12" style="border-bottom:1px solid red; "></div>

2

Answers


  1. Try setting your div margin and padding to 0 with !important rule.

    Login or Signup to reply.
  2. There are few limitation in Bootstrap 3 for removing columns padding You need to write p-0 class with padding: 0 !important CSS and add p-0 class in all right section. I just updated your code, i hope it’ll help you out. Thanks

    .p-0 {
      padding: 0 !important;
    }
    
    .row-eq-height {
      display: flex;
    }
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
    
    <div class="container" style="color:white;">
           <div>
               <div class="row row-eq-height">
               <div class="col-lg-5 col-md-5" >
                   <div class="row row-eq-height">
                       <div class="col-md-4 col-lg-4" style="background-color:darkorange;padding:15px; text-align:center;">
                           <div><i class="fa fa-book fa-5x" ></i></div>
                           <div style="color:white;font-size:large;">Grades</div>
                       </div>
                       <div class="col-md-8 col-lg-8 p-0" style="background-color:#FFB964; font-weight:bold; ">
                           
                           <div class="col-md-12 col-lg-12"  >
                               <span style="font-size:48px;color:silver;">0</span>
                               <span style="font-size:large;">New Grades</span>
                           </div>
                           <div class="col-md-12" style="border-bottom:1px solid red; "></div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Last Grade: 100</span> <span style="float:right;">Date: 3/26</span>
                           </div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Name: Animal Thumbnail</span>
                           </div>
                       </div>
                   </div>
                   
               </div>
               <div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2">
                     <div class="row row-eq-height">
                       <div class="col-md-4 col-lg-4" style="background-color:deepskyblue;padding:15px; text-align:center;">
                           <div><i class="fa fa-pencil fa-5x" ></i></div>
                           <div style="color:white;font-size:large;">Grades</div>
                       </div>
                       <div class="col-md-8 col-lg-8 p-0" style="background-color:#5BD4FC; font-weight:bold; ">
                           <div class="col-md-12 col-lg-12">
                               <span style="font-size:48px;color:silver;padding:10px;">0</span>
                               <span style="font-size:large;">New Assignments</span>
                           </div>
                            <div class="col-md-12" style="border-bottom:1px solid red; "></div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Last Grade: 100</span> <span style="float:right;">Date: 3/26</span>
                           </div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Name: Animal Thumbnail</span>
                           </div>
                       </div>
                   </div>
               </div>
           </div>
           </div>
           <div style="padding-top:50px;">
               <div class="row row-eq-height">
               <div class="col-lg-5 col-md-5" >
                   <div class="row row-eq-height">
                       <div class="col-md-4 col-lg-4" style="background-color:rebeccapurple;padding:15px; text-align:center;">
                           <div><i class="fa fa-check-square-o fa-5x" ></i></div>
                           <div style="color:white;font-size:large;">Grades</div>
                       </div>
                       <div class="col-md-8 col-lg-8 p-0" style="background-color:#8F59FF; font-weight:bold; ">
                           <div class="col-md-12 col-lg-12">
                               <span style="font-size:48px;color:silver;padding:10px;">0</span>
                               <span style="font-size:large;">New Postings</span>
                           </div>
                            <div class="col-md-12" style="border-bottom:1px solid red; "></div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Last Abs Per: 07</span> <span style="float:right;">Date: 3/26</span>
                           </div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Name: Absent-Unexcused</span>
                           </div>
                       </div>
                   </div>
                   
               </div>
               <div class="col-lg-5 col-md-5 col-lg-offset-2 col-md-offset-2">
                     <div class="row row-eq-height">
                       <div class="col-md-4 col-lg-4" style="background-color:crimson;padding:15px; text-align:center;">
                           <div><i class="fa fa-comment-o fa-5x" ></i></div>
                           <div style="color:white;font-size:large;">Messages</div>
                       </div>
                       <div class="col-md-8 col-lg-8 p-0" style="background-color:#F16A85; font-weight:bold; ">
                           <div class="col-md-12 col-lg-12">
                               <span style="font-size:48px;color:silver;padding:10px;">0</span>
                               <span style="font-size:large;">New Messages</span>
                           </div>
                            <div class="col-md-12" style="border-bottom:1px solid red; "></div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Last Grade: 100</span> <span style="float:right;">Date: 3/26</span>
                           </div>
                           <div class="col-md-12 col-lg-12" style="padding:5px;">
                               <span style="float:left;">Name: Animal Thumbnail</span>
                           </div>
                       </div>
                   </div>
               </div>
           </div>
           </div>
           
       </div>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search