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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:27:53+00:00 2026-05-30T13:27:53+00:00

I have the following HTML snippet: <body> <div class=main> <div class=topBar> <p>testing</p> </div> <div

  • 0

I have the following HTML snippet:

<body>
    <div class="main">

        <div class="topBar">
            <p>testing</p>
        </div>

        <div class="content">

            <div class="broadcastBar">
                <p>testing</p>
            </div>

            <div class="mainBody">
                <p>more testing</p>
            </div>

        </div>

    </div>    
</body>

Here is my CSS:

div.main {

}

div.topBar {
    background-color: Black;
    color: White;
    height: 50px;
    width: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
}

div.broadcastBar {
    background-color: Gray;
    width: 300px;
    position: absolute;
    right: 0px;
    top: 0px;
    height: 100%;
}

div.content {
    background-color: Yellow;
    position: absolute;
    width: 100%;
    top: 50px;
    left: 0px;
    height: 100%;
}

My question is this. As you can see by the markup and CSS, I’m trying to have divs be the sections of the screen. But because <div class="content" /> has a position of absolute, it is causing the div to push below the browser window by 50px (which is what it is relative to the topBar).

I’ve tried making it so that the content div doesn’t have to be position absolute, but everything just pushes the divs all around and the div edges are no longer flush to each other or the browser window.

Any idea what I can do hear to alleviate my issue?

Edit

Added desired output: this screenshot is currently what the above markup and CSS render. This is what I’m going for (for the most part, without the extended/scroll bar effect). I want to have my divs flush against each other and to the browser window.

What is the best way to do this if not through absolute positioning?

enter image description here

  • 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-30T13:27:55+00:00Added an answer on May 30, 2026 at 1:27 pm

    What you are going to want to learn is using some standard formatting practises with float.

    Using absolute to position your elements will in the long run hurt you. If all your elements are using float, you will be able to better control their appearance.

    For Example:

    div.topBar {
        background-color: Black;
        color: White;
        height: 20%;
        width: 100%;
        float: left;
    }
    
    div.broadcastBar {
        background-color: Gray;
        width: 70%;
        height: 80%;
        float: left;
    }
    
    div.content {
        background-color: Yellow;
        width: 30%;
        height: 80%;
        float: left;
    }
    

    @EDIT:

    So you Have 3 divs and you will want to stack them sequencially.

    <div class="header">headerdiv</div>
    <div class="left">leftdiv</div>
    <div class="right">rightdiv</div>
    

    Float follows this sequence so that by using these properties, elelments will be forced to fall after one another based on space constraints:

    div.header {
        background-color: Black;
        color: White;
        height: 20%;
        width: 100%;
        float: left;
    }
    
    div.left {
        background-color: Gray;
        height: 80%;
        width: 70%;
        float: left;
    }
    
    div.right {
        background-color: Yellow;
        height: 80%;        
        width: 30%;
        float: left;
    }
    

    @QUESTION:

    So If you need to use pixel measurements, then you will need to encapsulate all of the elements in another container with the max width and height that your layout will be.

    <div class="container">
        <div class="header">headerdiv</div>
        <div class="left">leftdiv</div>
        <div class="right">rightdiv</div>
    </div>
    
    div.container{
        height: 100px;
        width: 100px;
        float: left;
    }
    
    div.header {
        background-color: Black;
        color: White;
        height: 20px;
        width: 100px;
        float: left;
    }
    
    div.left {
        background-color: Gray;
        height: 80px;
        width: 70px;
        float: left;
    }
    
    div.right {
        background-color: Yellow;
        height: 80px;        
        width: 30px;
        float: left;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following snippet in one of my html pages : <div class=inputboximage>
I have following html snippet: <div class=rsw-pp rsw-pp-widget> <div g:type=AverageStarRating g:secondaryurls=http://maps.google.com/?cid=12948004443906002997 g:decorateusingsecondary=http://maps.google.com/?cid=12948004443906002997 g:groups=maps g:rating_override=2.998000
I have the following html snippet: <a href=page1.aspx class=title>page title goes here</a><br /> <span
Let's say I have the following HTML snippet: <div abc:section=section1> <p>Content...</p> </div> <div abc:section=section2>
I have the following html <div id=menu> <ul class=horizMenu> <li id=active><a href=# id=current>About</a></li> <li><a
I have the following HTML (a snippet): <td class=ms-vb-title height=100%> <table class=ms-unselectedtitle onmouseover=OnItem(this) ctxname=ctx1
I have the following snippet to scroll my form to the first error: $('html,body').stop().delay(500).animate({scrollTop:
I have the following HTML snippet: Block 1: <div style="position: absolute; top: 105px; left:
I have the following html snippet: <div id=contentX><h1>MyHeading1</h1></div> I could select with jQuery snippet
I have following html: <div id=nav> <ul> <li class=keyitem>keyitem 1</li> <li>item</li> <li>item</li> <li>item</li> <li

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.