Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Media query example</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<div class="boxes box1">
<h1>First Box</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae
quibusdam non, reprehenderit neque ut nihil similique fugit vitae
doloremque facilis, ad impedit, incidunt eveniet itaque eius sapiente
porro dolorum placeat?
</p>
</div>
<div class="boxes box2">
<h1>Second Box</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae
quibusdam non, reprehenderit neque ut nihil similique fugit vitae
doloremque facilis, ad impedit, incidunt eveniet itaque eius sapiente
porro dolorum placeat?
</p>
</div>
<div class="boxes box3">
<h1>Third Box</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae
quibusdam non, reprehenderit neque ut nihil similique fugit vitae
doloremque facilis, ad impedit, incidunt eveniet itaque eius sapiente
porro dolorum placeat?
</p>
</div>
<div class="boxes box4">
<h1>Fourth Box</h1>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Beatae
quibusdam non, reprehenderit neque ut nihil similique fugit vitae
doloremque facilis, ad impedit, incidunt eveniet itaque eius sapiente
porro dolorum placeat?
</p>
</div>
</div>
</body>
</html>
.container {
display: flex;
flex-wrap: wrap;
width: 980px;
margin: 0 auto;
margin-top: 40px;
}
.boxes {
height: 100%;
width: 460px;
margin: 10px 25px 30px 0px;
background: #fff;
border-radius: 5px;
box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.01);
}
.boxes p {
padding: 20px 20px;
text-align: justify;
font-size: 20px;
}
h1 {
text-align: center;
}
@media only screen and (min-width: 320px) and (max-width: 576px) {
.container {
width: 100%;
padding-left: 23px;
flex-direction: column-reverse;
}
.boxes {
width: 100%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment