Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full width hero unit in Twitter Bootstrap

In this example layout I want only hero unit to be 100% wide and rest within the default grid. For example, check this site. It has only the hero unit part (showcase area) in full width and rest in fixed width (navigation, bottom content, footer).

I need to do this without losing responsive design feature.

like image 445
eth.block Avatar asked May 07 '12 13:05

eth.block


2 Answers

move your .hero-unit div outside of your .container div.

the .container style confines you to a set width. and anything inside it will have a maximum width of it's parent. instead of:

<div class="container">
   <div class="hero-unit">
   </div>
</div>

use:

<div class="hero-unit">
</div>
<div class="container">
</div>
like image 79
Rodik Avatar answered Nov 15 '22 22:11

Rodik


Well the answer is right but whenever you resize the site, hero-unit will then change to have spaces around (20px right, 20px left) because all the elements are bound to this body has paddings in @media max-width: 767px. Just do the code below to fix it too:

@media (max-width: 767px) { .hero-container { margin-right: -20px; margin-left: -20px; } }

like image 5
Rafael 'BSIDES' Pereira Avatar answered Nov 16 '22 00:11

Rafael 'BSIDES' Pereira