I have this project I'm working on where I have to make a simple webpage where there are three divs of equal size side by side. Here's a project description.
I've tried a lot of different ways to make it responsive, by making the first and second divs float left and making the third div float right and setting width to 30%.
I've also tried setting their display to inline-block and setting the width however the layout might work but when I change the viewport width, it changes the layout like the last div wraps below the others. I'm not sure why this happens, does anyone have any ideas?
Code:
body{
background-color: #cfcfcf;
font-family:Arial, Helvetica, sans-serif;
}
h1{
text-align:center;
}
div{
background-color: rgb(183, 183, 183);
font-size:30px;
border:dotted;
}
/* Large Devices*/
@media(min-width:992px){
.Parent{
width: 30%;
display:inline-block;
height:300px;
overflow: hidden;
margin:2.5%;
}
div.child_tag{
padding:2.5%;
float:right;
width:30%;
text-align:center;
font-size:30px;
}
#chicken
{
background-color: #e99191;
}
#beef{
background-color:#dfb2d9;
}
#sushi{
background-color:#aadae6;
}
}
<!DOCTYPE html>
<head>
<title>
Module 2 Solution
</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="stylesheet.css">
</head>
<body>
<h1>Our Menu</h1>
<div class = "col-lg-4 col-md-6 col-sm-12 Parent" id = "chicken_p">
<div id = "chicken" class="child_tag">Chicken</div>
<p>Lssdfjsdf lsjfljsd jsdjsdl ljljlsdlj lsdjflsj lsjdljsd</p>
</div>
<div class = "col-lg-4 col-md-6 col-sm-12 Parent" id = "beef_p">
<div id = "beef" class="child_tag">Beef</div>
<p>Lssdfjsdf lsjfljsd jsdjsdl ljljlsdlj lsdjflsj lsjdljsd</p>
</div>
<div class = "col-lg-4 col-md-12 col-sm-12 Parent" id = "sushi_p">
<div id = "sushi" class="child_tag">Sushi</div>
<p>Lssdfjsdf lsjfljsd jsdjsdl ljljlsdlj lsdjflsj lsjdljsd</p>
</div>
</body>