I am still a beginner in CSS and am trying to make a tiles/cards design. I have reached this code, and I want to know if my layout this way is good or if there are any improvements I need to make.
Is writing margin and padding auto is the right practice? How about using flexbox as am doing?
html{
font-size: 12px;
font-family: Arial, sans-serif;
}
body{
margin: auto;
padding: auto;
/* What's the best practice to align content in the middle */
}
h1{
background-color: red;
text-align: center;
height: 50px;
vertical-align: /*What to put here to make it centered? */ ;
}
.flex{
display: flex;
}
.item{
width: 30%;
}
.item h3{
color: grey;
}
.item span{
font-style: italic;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet/less" href="style.less" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.6.1/less.min.js"></script>
<script src="script.js"></script>
</head>
<body>
<h1>Hello Plunker!</h1>
<div class="flex">
<div class="item red">
<h3>
Project 1
</h3>
<span>Time: 10:30AM</span>
</div>
<div class="item green">
<h3>
Project 2
</h3>
<span>Time: 10:30AM</span>
</div>
<div class="item blue">
<h3>
Project 3
</h3>
<span>Time: 10:30AM</span>
</div>
<div class="item yellow">
<h3>
Project 4
</h3>
<span>Time: 10:30AM</span>
</div>
<div class="item navy">
<h3>
Project 5
</h3>
<span>Time: 10:30AM</span>
</div>
</div>
</body>
</html>