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).. Though technically removing the transparent keyword, this doesn't change anything as it has been incorporated as a true : Backgrounds … Background-color values can be expressed in hexadecimal values such as #FFFFFF, #000000, and #FF0000. Specification Comment Feedback; CSS Backgrounds and Borders Module Level 3 The definition of 'background-color' in that specification. Quirky background-color. You can also create a CSS class and set the "background-color" attribute, as shown in the example below. or. Example code In the CSS code above, there are three elements being defined. In the css file you could use: * {background-color: black} // All elements now have a black background. 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 - You are only setting the body 's background color, but your body is extremely small in height since you have no content. html {background-color: black} // The page now have a black background, all elements remain the same. You can use rgba() color codes: the first 3 values are for rgb; the 4th value is for the alpha channel and defines the opacity of the color; The alpha value can go from zero 0 (transparent) to one 1 (opaque).

body { background-color: #efefef; } One thing you have to watch out for, though — if you set the background-color too dark, the default black text won’t be readable, so you’ll need to change it (or not make the background so dark).

The body's size is dynamic, it is only as large as the size of its contents. Unless the background-color gets set on the html element, then it doesn’t. If flooding is the goal, it can be smart to just set it on the html element to begin with. Background-color values can be expressed using rgb such as rgb(255,255,255), rgb(0,0,0), and rgb(255,0,0). Your CSS reset file sets the background color of html which is the entire page. Color Names Supported by All Browsers. There is a weird thing in CSS where the background-color on floods the whole viewport even if the metrics of the element itself don’t cover that whole area. Highlight text with CSS & HTML. All modern browsers support the following 140 color names (click on a color name, or a hex value, to view the color as the background-color along with different text colors): Click here to see the 140 colors sorted by HEX Value The value in the CSS background-color property can be expressed as a hexadecimal value, rgb value, or as a named color.