I've tried various post answers but still not able to center the divs I had.
Here is my Html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dashboard</title>
<link rel="stylesheet" href="dashboard.css">
</head>
<body>
<div class="maindiv">
<div class="row1">
</div>
<div class="row1">
</div>
<div class="row1">
</div>
</div>
</body>
</html>
The CSS I was using is below:
body{
font-family: Myriad Set Pro;
background-color: #f7f8f9;
}
.maindiv{
padding: 20px;
width: 70%;
margin: 0 auto;
border: 1px solid black;
}
#innerrow1{
width: 80%;
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
.row1{
margin: 0 auto;
display: inline-block;
background-color: #efefef;
border: 1px solid #b5b5b5;
width : 300px;;
height: 290px;
}
I used float:left
for placing divs next to each other but I had issues with height. I'm using display:inline-block
for that instead. Jsfiddle link : https://jsfiddle.net/Lywbygum/