Quirky background-color. Though technically removing the transparent keyword, this doesn't change anything as it has been incorporated as a true
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.
The value in the CSS background-color property can be expressed as a hexadecimal value, rgb value, or as a named color. 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).. 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). or. 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). Highlight text with CSS & HTML. 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. Color Names Supported by All Browsers. Specification Comment Feedback; CSS Backgrounds and Borders Module Level 3 The definition of 'background-color' in that specification. You can also create a CSS class and set the "background-color" attribute, as shown in the example below. 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 Background-color values can be expressed using rgb such as rgb(255,255,255), rgb(0,0,0), and rgb(255,0,0). The body's size is dynamic, it is only as large as the size of its contents. In the css file you could use: * {background-color: black} // All elements now have a black background. Example code In the CSS code above, there are three elements being defined. Your CSS reset file sets the background color of html which is the entire page. Unless the background-color gets set on the html element, then it doesn’t.