Beispiel:Grid-named-6.html
<!DOCTYPE html> <html lang="de"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Benannte Rasterbereiche - 6</title>
<style> body { display: grid; gap: 0.5em; grid-template-columns: 1fr 2fr 1fr; grid-template-areas: "head head head" ". main nav" ". main news" "foot foot foot"; grid-template-rows: min-content [nav-start main-top] 1fr [aside-start] 1fr [footer-start main-bottom] min-content; }
header {
grid-area: head;
}
nav { grid-area: nav; }
article { grid-area: main; }
- news {
grid-area: news; padding: 1em; }
footer { grid-area: foot; }
header, nav, main, article, section, footer {
border-radius: 0 0.5em 0.5em; border: medium solid; padding: 1em;
}
header { display: grid; grid-template-columns: 4em 1fr; gap: .5em;
img { width: 2.25em; aspect-ratio: 1/1; padding-top: 1.5em; } }
nav { background: #fffbf0; border-color: #e7c157; }
article { background: #ffede0; border-color: #df6c20; }
header, footer { background: #F1F3F4; border-color: #d5d5d5; }
footer * {
float: right;
clear: right;
margin: 0 0 1em;
}
body{ margin: 0 auto; max-width: 60em; min-height: 100dvh; font-family: sans-serif; }
</style>
</head>
<body> <header> <img src="https://wiki.selfhtml.org/images/4/45/SELF-Logo.svg" alt="logo">
Inhaltsverzeichnis
Benannte Raster und leere Stellen - 6
</header><nav>
- <a href="#link_1.html">Startseite</a>
- <a href="#link_2.html">Unterseite 1</a>
- <a href="#link_3.html">Unterseite 2</a>
- <a href="#link_4.html">Kontakt</a>
</nav> <aside id="news">
<a href="https://wiki.selfhtml.org/wiki/Webdesign/Wei%C3%9Fraum">Weißraum</a> ist aktives Element, kein passiver Hintergrund!
</aside> <article>
Media Queries
body {
display: grid;
gap: 0.5em;
grid-template-columns: 1fr 3fr 1fr;
grid-template-areas:
"head head head"
". main nav"
". main news"
"foot foot foot";
}
Im Mobile first! werde alle Elemente untereinander dargestellt – allerdings wird die Navigation nach unten geschoben, damit der Hauptinhalt sicher im Viewport ist.
Sobald der Viewport breit genug ist, wird das 3-Spalten-Layout; später sogar ein 4-Spalten-Layout dargestellt.
</article>
<footer> <a href="#kontakt.html">Kontakt</a>
© 2026 SELFHTML
</footer>
</body> </html>