I have seen this coding in a video-workshop. It shall help to see the different boxes within a HTML-layout.
header,
main,
nav,
article,
aside,
footer {
background-color: rgba(0, 0, 0, 0.2);
padding: 0.5em;
margin-bottom: 0.5em;
}
* {
box-sizing: border-box;
}
body {
background-color: green;
color: white;
}
The HTML:
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Titel der Seite</title>
<link rel="stylesheet" href="#">
<link rel="stylesheet" href="#">
</head>
<body>
<header>
<a href="#">
Logo – Beschreibung
</a>
<nav>
Navigation
</nav>
</header>
<main>
<article>
<h1>Hauptinhalt</h1>
<p>Text</p>
</article>
<aside>
Seitenleiste
</aside>
</main>
<footer>
<nav>
Navigation
</nav>
<nav>
Navigation
</nav>
</footer>
</body>
</html>
It works. Please see here!
What drives me nuts currently: Where is this in-between dark-green specified, which the margins and paddings around the boxes have?
In CSS you have only two background-color definitions.