Simple HTML for Practice
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Module2-Solution</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<h1>Our Menu</h1>
<div class="row">
<section class="title">
<h2 id="box1">Chicken</h2>
<p>Placeholder Text</p>
</section>
<section class="title">
<h2 id="box2">Beef</h2>
<p>Placeholder Text</p>
</section>
<section class="title">
<h2 id="box3">Sushi</h2>
<p>Placeholder Text</p>
</section>
</div>
</body>
</html>
CSS
*{
box-sizing: border-box;
margin: 0;
}
h1{
text-align: center;
margin-top: 50px;
margin-bottom: 50px;
font-size: 1.75em;
}
section{
border: 1px solid black;
margin-bottom: 20px;
background-color: grey;
float: left;
margin-right: 10px;
}
h2{
width: 120px;
border: 1px solid black;
text-align: center;
float: right;
position: relative;
font-size: 1.25em;
}
p{
height: 250px;
margin-top: 30px;
padding: 10px;
}
.row{
padding: 20px;
}
#box1{
background-color: salmon;
}
#box2{
background-color: red;
color: ghostwhite;
}
#box3{
background-color: yellow;
}
@media(min-width: 992px){
section{
width: calc(33.3% - 10px);
}
}
@media(min-width: 762px) and (max-width: 991px){
section{
width: calc(50% - 10px);
}
section:nth-child(2){
margin-right:0 ;
}
section:last-child{
width: 100%;
}
}
@media(max-width: 761px){
section{
width: 100%;
}
}