Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7908655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:03:23+00:00 2026-06-03T12:03:23+00:00

How do you style a div in Bootstrap to span the entire width of

  • 0

How do you style a div in Bootstrap to span the entire width of the viewport (without fixed positioning) within the normal 12-grid system of “rows” and “spans”?

In the Bootstrap source, the navbar-fixed-top class achieves this effect using a fixed position and left and right attributes:

.navbar-fixed-top,
.navbar-fixed-bottom {
  position: fixed;
  right: 0;
  left: 0;
  z-index: 1030;
  margin-bottom: 0;
}

However, this navbar stays in the window regardless of scrolling. What styles are necessary to achieve the same entire width of the viewport without fixed positioning?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:03:25+00:00Added an answer on June 3, 2026 at 12:03 pm

    You can get that effect by stretching the body and html tags 100% in height and width and then defining a child div to that same width. We do that because width and height are relative, so if we define a div 100% in width/height it will only stretch so far as the body and html tag. Take a look at this example:

    html, body {
        width:100%;
        height:100%;
    }
    
    body {
        padding-top:60px;
    }
    
    .wrapper {
        height: 100%;
        width: 100%;
    }
    
    .huge {
        width:100%;
        height:100%;
        background-color:#eee;
    }
    

    Demo, edit here.

    Note: There is some extra height added to the body of the .huge div due to the padding-top added to the body to make way for the top navbar, if that padding is removed it will become a “true” 100% height and not 100% height + top 60px as it is now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: JavaScript library to create div-style window within page I would like to
<!doctype html> <html> <body> <div id = 'div' style = 'width:100px;height:100px;background:#000000;'></div> <script type =
In the following style: .slider div div div h2 span { color:#ae663d;} What is
i am trying to style a div with box-shadow and gradient cross-browsed. I am
I want that part 1 onclick div style changes and part 2 again on
Say I have a loop of objects (style.cover.pic) in a DIV .style_image <div class=style_image>
what is the proper code for this? in div style code. I know how
I want the style of three div align as same as the following picture.
I have this CSS style that does a rounded corners for div border, but
I have a div with an id of 'gallery' and I want to style

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.