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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:57:06+00:00 2026-06-13T12:57:06+00:00

This is my first time on this forum and ill try to be clear

  • 0

This is my first time on this forum and ill try to be clear as possible, i have a problem with creating a small website for my own, specifically with the header. Im trying to create a page which has a wrapper of 1024px center (margin: 0 auto;) and i would like 2 divs, on both sides of this wrapper where i can use another picture as background. My current css looks like this:

body, html      
background: url(../images/bg.jpg);
background-repeat: no-repeat;
background-position: top center;
margin: 0;
padding: 0;
}
#wrapper
margin: 0 auto;
width: 1024px;
}
#header {
width: 1024px;
height: 254px;
background-image: url(../images/header2.png);
background-repeat: none;
position: relative;
}
#header_right {
width: 50%;
right: 0;
background-image: url(../images/header_right2.png);
position: absolute;
height: 254px;
}
#header_left {
width: 50%;
left: 0px;
background-image: url(../images/header_left.png);
position: absolute;
background-position: right;
margin-left: -512px;
height: 254px;
}

and my html looks like:

<body>
<div id="header_right"></div><!--End header right!-->
<div id="header_left"></div><!--End header right!-->
<div id="wrapper">
<div id="header"></div><!--End header!-->
<div id="content"></div><!--End Content!-->
</div><!--End wrapper!-->
</body>

What i’m trying to accomplish is to have a header that continues on both left and right (both headers use different backgrounds), in this case it does work on the left, because im using a negative margin, since i use 50% width and exactly the half of the wrapper (-512px), this works, but if i would try to use a negative margin on the right (margin-right: -512px) this will extend the page on the right with an extra 512px, which is not my intention.

I’ve been googling all day but can’t seem to find any answer to my question, also tried to make 3 divs with float: left , but couldnt figure out how to make 1 in the center with a width of 1024px and the rest 100% width, if anyone could help me out that would be really appreciated.

Kind regards

  • 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-13T12:57:07+00:00Added an answer on June 13, 2026 at 12:57 pm

    I am not entirely sure how you want it to look like, but I’ll give it a shot.
    If I’m way off, perhaps you could provide me with a schematic of sorts?

    In any case, the example given below does not use your specific code, but it should give you an idea of how it’s done.


    Result: first example

    The left and right headers are “infinite”, in that they always fill the entire page’s width.
    The middle header covers up the rest. If you’ve got background images you can use background-position to position them so that they align with the middle header’s left and right edges.


    Code | JSFiddle example

    HTML

    <div class='side_wrapper'>
        <div class='left_header'></div><div class='right_header'></div>
    </div>
    <div class='header'></div>
    <div class='content'>
        Content here
    </div>
    

    CSS

    .header, .side_wrapper, .left_header, .right_header{
        height: 100px;
    }
    
    .header, .content{
        width: 400px;
        margin: 0 auto;
    }
    
    .side_wrapper{
        width: 100%;
        white-space: nowrap;
    }
    
    .left_header, .right_header{
        width: 50%;
        display: inline-block;
    }
    
    .left_header{
        background-color: blue;
    }
    
    .right_header{
        background-color: lightblue;
    }
    
    .header{
        position:absolute;
        top: 0;
        left: 50%;
        margin-left: -200px;
        background-color: red;
    }
    
    .content{
        background-color: green;
        text-align: center;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry, this is my first time using this forum. Apparently people can edit my
this is my first time on this forum, so forgive me if my question
This is my first time working with a WPF datagrid. From what I understand
this is my first time asking a question here. I tried to be well
This is my first time that I use WCF and Android. So, sorry for
This is my first time using XML documents. What I'm trying to do is
This is the first time, I am involved in writing a complete client for
This is my first time playing with Active Directory, as well as the Ajax
This is my first time using this site and I am quite new to
This is the first time I got this error. This code basically gets the

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.