Skip to main content
warpigs666
Inspiring
July 2, 2019
Question

Constrain total width of Bootstrap site?

  • July 2, 2019
  • 5 replies
  • 644 views

Hi. I'm customizing a Bootstrap template trying to teach myself Bootstrap. Is it possible to set the max-width of the page? When I try to set the max-width in css under the body tag it only affects the width of the main section for some reason, not the whole page. I am trying to constrain the whole page to be only 75% of the available screen space.

Here is a link to the files:

https://drive.google.com/open?id=1UGeCe2TcsXVCEO_ReNsOoCNFXInnfU54

Thanks in advance!

This topic has been closed for replies.

5 replies

warpigs666
Inspiring
July 13, 2019

Thanks for you help everyone (except the person who said 'it looks fine the way it is...'

I'm still working on this and will report back.

BenPleysier
Community Expert
Community Expert
July 14, 2019

Have a look at using position: sticky instead of position: fixed. See for more: How to make a sticky sidebar with two lines of CSS - DEV Community   ‍    ‍ 

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
warpigs666
Inspiring
July 8, 2019

Thanks all. I don't really know how to answer the questions. Like I said I'm learning bootstrap. I believe I'm using 4.3.1

None of the above code works. When I add <body class="container-fluid w-75"> as mentioned above it just cause the main section of the page to go crazy. Here's a link to the template if you don't want to download my files:

https://startbootstrap.com/themes/resume/

Nancy OShea
Community Expert
Community Expert
July 8, 2019

Why do you think it needs additional constraining?  It looks fine to me the way it is. 

If you're not seeing it this way (see screenshot), check your code for validation errors.

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
July 2, 2019

Which version of Bootstrap are you using?  It matters a lot because older Bootstrap uses different classes and layout methods. 

Nancy O'Shea— Product User & Community Expert
BenPleysier
Community Expert
Community Expert
July 2, 2019

Add the following two classes to the body tag

<body class="container-fluid w-75">

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
warpigs666
Inspiring
July 2, 2019

That didn't work any other ideas?

Nancy OShea
Community Expert
Community Expert
July 2, 2019

I don't download files from untrusted sources, sorry.   If you care to upload your work in progress to a remote server you control, I'll be happy to look at the site online with my browser.

Bootstrap has 2 container classes.

container-fluid = full screen

container = partial & centered.

Wrap your content inside

<div class="container">

<div class="row">

<div class="col">

        CONTENT GOES HERE....

</div>

</div>

</div>

Nancy O'Shea— Product User & Community Expert
warpigs666
Inspiring
July 2, 2019

Ok I'll do that if no one else knows how to fix it thanks.

Legend
July 2, 2019

assuming the layout uses container-fluid I'd have though you could add a css rule something like this:

.container-fluid {
  margin
: 0 auto;
  max
-width: 1920px
}

Paul-M - Community Expert