Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

override bootstrap container width

I have an easy HTML template using bootstrap 3. Template has following structure: static header, static footer and content which is in the bootstrap's class "Container". In the middle of content I have bootstrap'w "Well" and i want it make looks like header and footer. I mean I want it to be the full width of the screen on any screen.

I created easy fiddle.

Here's a question, is there any way to override container's width inside this container?

<header>
   <div class="container">
      <div class="content">

      </div>
      <div class="well">

      </div>
      <div class="content">

      </div>
   </div>
<footer>

enter image description here

like image 446
user3127896 Avatar asked Apr 10 '14 18:04

user3127896


People also ask

How do I resize a container in Bootstrap?

You can either use <div class="container-fixed"> or your own media query in which you can specify the custom width for various resolution. Show activity on this post. The default Bootstrap . container class has 15px padding on both left and right sides.

How do you increase the width of a container?

Go to the Customize section on Bootstrap site and choose the size you prefer. You'll have to set @gridColumnWidth and @gridGutterWidth variables. For example: @gridColumnWidth = 65px and @gridGutterWidth = 20px results on a 1000px layout.

How do I override Bootstrap variables?

Override Variables Bootstrap has its own “_variables. scss” in the “scss” folder, which contains all variables used in Bootstrap. Now, add the “abstracts” name folder in your scss folder and create “_custom-variables. scss” in that folder.


1 Answers

Here theres a simpler trick that works like a charm: https://css-tricks.com/full-width-containers-limited-width-parents/

Look for: "No calc() needed"

HTML

<header>
    <div class="container">
        <div class="content"></div>
        <div class="well full-width"></div>
        <div class="content"></div>
    </div>
    <footer>

CSS

.full-width {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}
like image 86
Gonzalo Avatar answered Sep 17 '22 15:09

Gonzalo