css body background color code example

Example 1: html background color

<html>
 
<body style="background-color:red;">
  <p> test <p/> 
  <body/>
  </html>

Example 2: css background color

body {
  background-color: green;
}

Example 3: css change background color of page

/* Use the following code: */
html {background-color: #fefefe;} 
/* You can change the hexedecimal code to RGB, RGBA, name & more colors!*/

Example 4: how to change background color in css

body{
  background: lightblue;
}

Example 5: background color

//javascript type css:
document.body.style.backgroundColor = "blue";
// or inline css:
<div style="background-color: blue;"></div>

Example 6: adding background image css

/* Answer to: "adding background image css" */

/*
  The background-image property sets one or more background images
  for an element.

  By default, a background-image is placed at the top-left corner
  of an element, and repeated both vertically and horizontally.

  Tip: The background of an element is the total size of the
  element, including padding and border (but not the margin).

  Tip: Always set a background-color to be used if the image is
  unavailable.
*/

/* Set a background-image for the <body> element: */

body {
 background-image: url("paper.gif");
 background-color: #cccccc;
}

/* Set two background images for the <body> element: */

body {
  background-image: url("img_tree.gif"), url("paper.gif");
  background-color: #cccccc;
}