I'm trying to get my grid to only put 3 buttons per row, so that when I add a 4th, it should automatically be placed in the next row.
This is my code:
.div {
display: grid;
grid-template-columns: auto auto auto;
background: #3c763d;
}
.button {
background: #27ae60;
float: left;
margin: 6px 6px 6px 6px;
height: 2rem;
width: 8.33%;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.32), 0 1px 2px rgba(0, 0, 0, 0.34);
color: #f9f9f9;
text-align: center;
justify-content: center;
padding-top: 12px;
}
.button:hover {
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.24);
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<title>Rock, Paper, Scissors!</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<h1>Rock Paper Scissors</h1>
<h3>Make your selection!</h3>
<div>
<div class="button">Rock</div>
<div class="button">Paper</div>
<div class="button">Scissors</div>
<div class="button">Clear</div>
</div>
</html>
Instead, I keep getting left with a row of 4 buttons, instead of a row of 3, followed by a new row of 1. What am I misunderstanding here?