Cascading style sheet for page background

Posted on 1999-12-07
Medium Priority
Last Modified: 2013-11-19
Is it possible to set the background color of the page such that 50% of the page has one color and the other 50% has another color, the page color is partitioned vertically.

Please suggest ASAP

Question by:sumeet555
  • 2

Accepted Solution

rhinosaur earned 200 total points
ID: 2261562
Not that I know of - but have you thought about using a graphic that is 2000 pixels wide (i.e. larger than screen), 1 pixel high, and color the first 400 pixels one color the rest the other. Can't be sure it is centered though. Another method would be to use a table that is 100% wide, and split 50/50 between two rows ... each has a different bgcolor.

Hope that helps.

Expert Comment

ID: 2261567
Or you could use a 2000 pixel wide background again but in the style sheet set background-position: center. Have to watch out for Netscape though.
LVL 19

Expert Comment

ID: 2261777
how about making a layer....

use a bit of javascript that finds the height and width of the page and sets it's width accordingly, than in that layer make a table with width=100%
make two table cells and give 1 the first color and the other the other color.

Also make the height of the table 100% and that should do it.. i think it's a much prettier solution for Your problem...

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question