In: Computer Science
Create a style rule for the body element that:
Set the size of the grid items as follows:
<!DOCTYPE html>
<html>
<head>
<style>
p.ex1 {
margin: 30px auto;
}
.grid-container {
display: grid;
grid-template-columns: 1fr;
grid-template-columns: 50px, 30px, 1fr, 1fr, 100px;
grid-gap: 15px;
background-color: #2196F3;
padding: 10px;
}
.grid-container > div {
background-color: rgba(255, 255, 255, 0.8);
text-align: center;
padding: 20px 0;
font-size: 10px;
}
</style>
</head>
<body{min-width: 640px; max-width: 1024px; width: 90%;}>
<h1>Grid-template-columns and Grid-template-columns</h1>
<p>You can use the <em><b>Grid-template-columns and Grid-template-columns</em></b> property to specify the number of columns in your grid layout.</p>
<div class="grid-container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
</div>
<p class="ex1">This paragraph has a top and bottom margins 30 pixels and right and left margins are auto.</p>
</body>
</html>