css - Bootstrap and body padding left and right -


i using bootstrap create responsive web page. need add padding-left , padding-right body have 50px wide >empty safety area< on each side. problem: when resize viewport, content of container overflow on right.

is there simple way how achieve effect? tried following one, doesn't (the container narrow in end).

// container responsivity fix .container {   .container-fixed();    @media (min-width: @screen-sm-min) {     width: calc(~'@{container-sm} - 100px');   }   @media (min-width: @screen-md-min) {     width: calc(~'@{container-md} - 80px');   }   @media (min-width: @screen-lg-min) {     width: calc(~'@{container-lg} - 100px');   } } 

html structure:

<header>   <div class="container">     <div class="row">       <div class="col-xs-12 col-sm-4">         <a href="#">           logo         </a>       </div>       <div class="col-xs-12 col-sm-5">         <h2>lorem ipsum dolor sit amet, <strong> consectetur adipiscing elit.</strong> </h2>       </div>       <div class="col-xs-12 col-sm-3 text-right">         <i class="flag cz active">a</i>         <i class="flag uk">b</i>         <i class="flag ge">c</i>       </div>     </div>   </div> </header> 

fiddle: http://jsfiddle.net/o5bkpv7c/

the text not stretchy won't fit inside header past breakpoint. use break word or size text down or use fittext.js. there's cleaner ways of doing this.

demo: http://jsfiddle.net/o5bkpv7c/4/

body {     padding: 0 20px; } header {     background: lightblue;     padding: 1em 0;  }  header h2 {font-size:1.2rem;margin:10px 0;}   .flag {     width: 29px;     height: 20px;     display: inline-block;     background: red;  }  @media (min-width:768px) {      header h2 {font-size:1.3rem;margin:0;}  } 

also, see layout going for, wouldn't use grid system it. here's cleaner way.

http://jsbin.com/tuyeta/1/edit


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -