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 992041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:12:09+00:00 2026-05-16T06:12:09+00:00

I have a following HTML/CSS (simplified): <body> <style> body { margin: 0px; padding: 0px;

  • 0

I have a following HTML/CSS (simplified):

<body>        
<style>
        body
        {
            margin: 0px;
            padding: 0px;
            color: #fff;
            background-color: #090909;
            text-align: center; 
        }

        #content
        {
            width: 500px;
            margin: 0px auto;
            background-color: blue;
        }

        #header
        {
            width: 500px;
            margin: 0px auto;
            background-color: green;
        }

        #over-div {
            background-color: red;
            position: absolute;
            height: 20px;   
            width: 100%;
            margin: 0px; 
            top: 0px;
            left: 0px;
            -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
            filter: alpha(opacity=50);
            -khtml-opacity: 0.5;
            -moz-opacity: 0.5;
            opacity: 0.5;
       }
</style>
<div id="over-div">aa</div> 
<div id="header">
        header
</div>
<div id="content">
        content here
</div>
</body>

The idea is to have over-div to cover the upper part of the page completely (but do not keep it fixed there, so it is not visible when user scrolls down the page).

If you zoom-in extremely (Ctrl+ wheel) till the horizontal scrollbar appears, you can see that after scrolling completely to the right, the over-div does not cover the header completely to the right side of window.

I hoped that width:100% would mean “always use 100% width of the body”, but it seems it is not true for absolute positioned divs.

Tested browsers: Firefox 3.5, Chrome, IE8 (with and without compatibility mode).

Is there any way to get that div cover 100% width of page?

  • 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-05-16T06:12:10+00:00Added an answer on May 16, 2026 at 6:12 am

    Yes, add this to the #over-div styling:

    min-width:500px;
    

    That ensures that #over-div will be at least as wide as your #header and #content divs

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

Sidebar

Related Questions

I have the following CSS: html, body { background-color:black; font-family:arial bold; overflow:auto; text-align: center;
I have the following CSS and HTML: .TestPadding{ width:29px; text-align:center; height:18px; padding:3px 0px 2px
I have the following html: <style type=text/css> .message-view-value-td { vertical-align:bottom; } </style> <table width=600>
I have the following HTML <style type=text/css> <!-- .msg_ok{ font-family: Trebuchet MS; font-weight: bold;
I have the following HTML (note the CSS making the background black and text
I have following 2 lines in CSS file (I'm not CSS/html guy) #main_text{background:#0083c3; padding-right:23px;
I have the following HTML and CSS: <button id=myBtn dojoType=dijit.form.Button>Testing</button> #myBtn { margin-left: 100px;
I have the following html in my site: <link type=text/css href=/Styles/ui-lightness/jquery-ui-1.8.2.custom.css rel=Stylesheet /> <link
I have a problem with a following HTML/CSS code: CSS * { padding: 0;
I have the following html and css <div id=header> <div id=headerTopLeft> <div id=areaSelect style=display:

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.