Beispiel:CSS-Grid-mit-gap.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html lang="de">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css">
  <title>Grid mit Spalten (gap)</title>
  <style>

main {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px 25px;
}

p {
	border: 1px solid;
	border-radius: 0 .5em .5em;
	padding: 1em;
	height: 5em;
	background: #ffebe6;
	font-weight: bold;
	text-align: center;	
}

p:nth-of-type(2) {
	background: #fdfcf3;	
}

p:nth-of-type(3) {
	background: #ebf5d7;
}

p:nth-of-type(4) {
	background: #e6f2f7;
}

p:nth-of-type(5) {
	background: hsla(277, 53%, 73%,0.3) ;
}
</style>
</head>
<body>
  <h1>Grid mit Spalten (gap)</h1>
<main>  

    <p>1</p>
    <p>2</p>
    <p>3</p>  
    <p>4</p>   
    <p>5</p>             

</main>
</body>
</html>