html - Bootstrap grid, padding issue causing background to overflow -


situation

using boostrap v4, , when add background colour div, element appears become unaligned other elements in columns. have applied box-sizing: border-box yet isn't staying within container. never had issue before.

aim

to keep element within column

html

<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css">  <section class="container padding-bottom--md">     <div class="row">         <div class="col-md-6 bg--orange text-md-center padding-bottom--md padding-top--md">             <h5 class="text-uppercase txt--white">lorem ipsum</h5>             <p class="txt--white no-margin-bottom">a load of pish posh text</p>         </div>         <div class="col-md-6 bg--orange text-md-center padding-bottom--md padding-top--md">             <h5 class="text-uppercase txt--white">lorem ipsum</h5>             <p class="txt--white no-margin-bottom">a load of pish posh text</p>         </div>     </div>                           </section> 

css

* { box-sizing: border-box; }   .padding-top--sm { padding-top: 1rem; } .padding-bottom--sm { padding-bottom: 1rem; } 

i found way solve issue. add second inner div hold content without padding.

html

<section>     <div class="container">         <div class="row">             <div class="col-md-12 bg--white text-md-center padding-top--md">                 <div class="bg--orange padding-info-inner-md">                     <h5 class="text-uppercase txt--white">resource centre</h5>                     <p class="txt--white no-margin-bottom">got question? have checked our knowledge bank , guides?</p>                 </div>             </div>         </div>                       </div> </section> 

css

.bg--orange { background: #e64b3c; } .bg--white { background: #ffffff } .padding-info-inner-md { padding: 2rem; } 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -