Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set the page width to max 970px within Bootstrap 3

I am using Bootstrap 3 to build a website that displays nicely on mobile devices and desktops. The customer tells me that the max width of a page can only be 970px.

How can I do this with Bootstrap 3 to make sure that:

  1. The page still centered in a browser screen?

  2. All the great things in Bootstrap 3 are still there.

like image 643
curious1 Avatar asked Nov 22 '13 17:11

curious1


People also ask

How do I make Bootstrap container full width?

Choose from a responsive, fixed-width container (meaning its max-width changes at each breakpoint) or fluid-width (meaning it's 100% wide all the time). container-fluid class can be used to get full width container. container-fluid class provides a full-width container which spans the entire width of the viewport.

How can set width and height of image in Bootstrap?

Images in Bootstrap are made responsive with .img-fluid . max-width: 100%; and height: auto; are applied to the image so that it scales with the parent element.

Is Bootstrap 3 mobile first?

With Bootstrap 3, we've rewritten the project to be mobile friendly from the start. Instead of adding on optional mobile styles, they're baked right into the core. In fact, Bootstrap is mobile first. Mobile first styles can be found throughout the entire library instead of in separate files.

How do I change the width of a container in Bootstrap 5?

We can create a full width container in Bootstrap5 using “. container-fluid” class. It sets the container width equal to 100% in all screen sizes. This means the container spans the entire width of the viewport.


2 Answers

Do you want it responsive? Try this:

@media (min-width: 1200px) {
  .container {
    width: 970px;
   }
}

This will set container width to 970px for screens wider than 1200px.

like image 185
calofanas Avatar answered Oct 14 '22 08:10

calofanas


Bootstrap actually have a less feature on their website. Here you can pick and choose what components of bootstrap you want to use. All of bootstrap is made to be responsive so you can change the size to be whatever you want and everything will inherit from that.

So if you want to define .container as max-width: 970px that might serve your purposes. Or maybe just change the media query breakpoints.

Edit: Just took a look and you can define the size of your grid system for each screen size in the customize section. @container-sm, @container-md, @container-lg

Second Edit: I forgot about this resource I had bookmarked from a while back. You will probably find it useful

like image 23
echochamber Avatar answered Oct 14 '22 08:10

echochamber