Search notes:

CSS: Root element/canvas - Styles for body with and without styles for html element

body-with-html.html

This document specifies a background color for both the <html> and the <body> tag. The background color for the body is only used where the canvas is occupied:
<!DOCTYPE html>
<html<head><style>
  
  html {background-color: #e7ffe7; }
  body {background-color: #f0f0ff; width: 20em; padding: 0.4em; margin: 0}

</style></head><body>

  This document defines a greenish background for the <i>body</i> which is used to color the canvas which is not
  occupied by another element
 <br>
  The color of the body is only used for parts where other html elements cover the canvas.
    <p>
  Go to <a href='body-without-html.html'>Body without html</a>

</body></html>
Github repository about-CSS, path: /root-element/canvas/body-with-and-without-html/body-with-html.html

body-without-html.html

In contrast, this document specifies a background color only for the <body> element.
In this case, the body's background color is used to paint the entire canvas:
<!DOCTYPE html>
<html<head><style>
  
  body {background-color: #f0f0ff; width: 20em; margin: 0.4em }

</style></head><body>

  This document defines a bluish background for the <i>body</i>
 <br>
  Since no value for the <i>html</i> element is defined, the body's
  color is used for the entire canvas.
  <p>
  Go to <a href='body-with-html.html'>document that defines background colors for the body and html element</a>.

</body></html>
Github repository about-CSS, path: /root-element/canvas/body-with-and-without-html/body-without-html.html

See also

Experiment with the html and body tag

Index