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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:10:54+00:00 2026-05-27T14:10:54+00:00

Trying to achieve a background on a page that is "split in two"; two

  • 0

Trying to achieve a background on a page that is "split in two"; two colors on opposite sides (seemingly done by setting a default background-color on the body tag, then applying another onto a div that stretches the entire width of the window).

I did come up with a solution but unfortunately the background-size property doesn’t work in IE7/8 which is a must for this project –

body {
    background: #fff;
}
#wrapper {
    background: url(1px.png) repeat-y;
    background-size: 50% auto;
    width: 100%;
}

Since it’s just about solid colors maybe there is a way using only the regular background-color property?

  • 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-27T14:10:55+00:00Added an answer on May 27, 2026 at 2:10 pm

    Older Browser Support

    If older browser support is a must, so you can’t go with multiple backgrounds or gradients, you’re probably going to want to do something like this on a spare div element:

    #background {
        position: fixed;
        top: 0;
        left: 0;
        width: 50%;
        height: 100%;
        background-color: pink; 
    }
    

    Example: http://jsfiddle.net/PLfLW/1704/

    The solution uses an extra fixed div that fills half the screen. Since it’s fixed, it will remain in position even when your users scroll. You may have to fiddle with some z-indexes later, to make sure your other elements are above the background div, but it shouldn’t be too complex.

    If you have issues, just make sure the rest of your content has a z-index higher than the background element and you should be good to go.


    Modern Browsers

    If newer browsers are your only concern, there are a couple other methods you can use:

    Linear Gradient:

    This is definitely the easiest solution. You can use a linear-gradient in the background property of the body for a variety of effects.

    body {
        height: 100%;
        background: linear-gradient(90deg, #FFC0CB 50%, #00FFFF 50%);
    }
    

    This causes a hard cutoff at 50% for each color, so there isn’t a “gradient” as the name implies. Try experimenting with the “50%” piece of the style to see the different effects you can achieve.

    Example: http://jsfiddle.net/v14m59pq/2/

    Multiple Backgrounds with background-size:

    You can apply a background color to the html element, and then apply a background-image to the body element and use the background-size property to set it to 50% of the page width. This results in a similar effect, though would really only be used over gradients if you happen to be using an image or two.

    html {
        height: 100%;
        background-color: cyan;
    }
    
    body {
        height: 100%;
        background-image: url('http://i.imgur.com/9HMnxKs.png');
        background-repeat: repeat-y;
        background-size: 50% auto;
    }
    

    Example: http://jsfiddle.net/6vhshyxg/2/


    EXTRA NOTE: Notice that both the html and body elements are set to height: 100% in the latter examples. This is to make sure that even if your content is smaller than the page, the background will be at least the height of the user’s viewport. Without the explicit height, the background effect will only go down as far as your page content. It’s also just a good practice in general.

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

Sidebar

Related Questions

What I am trying to achieve is a form that has a button on
What I'm trying to achieve is to determine if the Postscript that I'm parsing
I'm trying to achieve a 50px space at the bottom of my page, below
What I am trying to achieve is to merge three strings. Two are provided
Im trying to achieve a design that has five columns with fluid width, but
I'm trying to achieve an application that allows to shoot a photo and display
I am trying to achieve a scrolling effect using jQuery. I have a background
Here is what im trying to achieve. I have a perl script that looks
I'm trying to achieve background subtraction in openCV 2.2 using the cv namespace (Qt4.7).
I'm trying to achieve this layout on my page amongst the #about1, #about2 #about3,

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.