-3

Do you realy need div class="container" ??

Firstly in Bootstrap and does it have any special functions? Secondly Using containers in bootstrap do the "div class container" have to have the same class name? If no why.

Thanks Quick questions that I was trying to figure out.

  • 1
    class="container" is used in bootstrap for css. Container class is used to create 'boxed' contents.You can miss this class depending upon your design requirements – Muhammad Atif Jan 01 '16 at 06:34
  • 1
    In short, usually **YES**; TWBS's `.container` class holds a left/right padding of `15px` (by default) which is necessary for the layout purposes if you're going to add `.row`s inside the containers and then `.col-x-#`s inside the rows. – Hashem Qolami Jan 01 '16 at 08:15
  • **Explanation:** `.row`s have a negative left/right `margin` of `-15px` and `.col-x-*`s have a left/right `padding` of `15px` by default. The gutters between columns are specified by left/right padding that is applied to each column. That way we can make sure that they would be aligned properly when they wrap into newlines in responsive design. But as we don't know WHERE exactly the columns would wrap, the `.row` have a left/right negative margin to hide the left padding of the first column and the right padding of the last one in that row [...] – Hashem Qolami Jan 01 '16 at 08:22
  • [...] But having negative margin would increase the width of the box model right? That's why the containers have also left/right padding to decrease the width of the content box of the row's containing block. Make sense? – Hashem Qolami Jan 01 '16 at 08:22

2 Answers2

0

If you need to use bootstrap for your project so need Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding in your page layout design.

GunvantParmar
  • 143
  • 1
  • 9
-1

It make the layout indent or at center of the view port and not neccessary to include at your div, its same as putting background red or black of your choice.

But it is always good practice to use bootstraping according to its preffered ways and this class makes your layout indent.

Anil Panwar
  • 2,592
  • 1
  • 11
  • 24
  • If you used some html5 in the container and you needed to style what was in the container. How would you do it. change the class name ?? – The Special One Jan 01 '16 at 06:38
  • You can override any class in the bootstrap its on you. You can put your own style aswell, but it is always recommended to use classes according bootstrap preffered ways. – Anil Panwar Jan 01 '16 at 06:42
  • Could you explain further. if possible with a demo, on how to override bootstrap with css – The Special One Jan 01 '16 at 06:44
  • I wud do for sure but as am in mobile phone I wud like to share this link http://stackoverflow.com/questions/10659070/styling-twitter-bootstrap-buttons that is overriding btn class with its own style , this way you can override any class but for that you proficient in css – Anil Panwar Jan 01 '16 at 06:49
  • I would not say I am proficient. But I will try. @Anil – The Special One Jan 01 '16 at 06:55