Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set the background color of the whole page in css

I am trying to set the background color of the page at yumdom.com to yellow.

I have tried the following and it fails:

body{ background-color: yellow;} /*only a sliver under the header turns yellow.*/  #doc3{ background-color: yellow;} /*result same as above*/  #bd { background-color: yellow;} /*result same as above*/  #yui-main { background-color: yellow;} /*a rectangle turns yellow ending at where the content ends. I want this rectangle to extend all the way to the footer.*/ 

Also note that if in the developer tools in Chrome I highlight either one of the html elements above, I get only a certain portion of the page highlighted. A footer and the section below the content remain un-highlighted.

I want the yellow to fill the entire space between the header and the footer and leave no white space out.

Note that we are using YUI Reset, Fonts, and Grids CSS templates V 2.8.0r4

Many thanks!

like image 452
rostam Avatar asked Mar 10 '12 18:03

rostam


People also ask

How do I change the background color on an entire page in CSS?

Approach: We can set a full-page background color by simply changing the screen height of an HTML body. In Tailwind CSS, we use an alternative of CSS background-color property which is represented as background-color-opacity ( eg: bg-blue-200 ) and it is used to specify the background color of an element.

How do you put a background color on a whole page?

To set the background color in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <body> tag, with the CSS property background-color. HTML5 do not support the <body> tag bgcolor attribute, so the CSS style is used to add background color.

What is the CSS code for background color?

Background-color values can be expressed in hexadecimal values such as #FFFFFF, #000000, and #FF0000. Background-color values can be expressed using rgb such as rgb(255,255,255), rgb(0,0,0), and rgb(255,0,0).

How do I change the background color of a whole page in react?

To change the background color of the body element in React, we can use the React Helmet package. We put the style element inside the Helmet component so that it's rendered in the head element. Then we use "body { background-color: orange; }" to set the background color of the body element.


1 Answers

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.

or

html {background-color: black} // The page now have a black background, all elements remain the same.

like image 92
IvanSoria_54 Avatar answered Sep 28 '22 03:09

IvanSoria_54