I am struggling with making the page responsive. The flex-wrap: nowrap
property seems to be causing issues. Can someone please assist me in identifying the root of the problem?
.logo {
text-decoration: none;
color: white;
}
.header {
width: 100%;
max-width: 960px;
min-width: 460px;
min-height: 100px;
margin: 0 auto 30px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
box-sizing: border-box;
}
.logo {
background: black;
width: 150px;
min-height: 50px;
align-items: center;
display: flex;
flex: none;
margin: 0 10px 40px;
justify-content: center;
}
.contnet {
background: black;
min-height: 50px;
font-size: 20px;
color: white;
margin-bottom: 40px;
flex-basis: 300px;
display: flex;
justify-content: center;
align-items: center;
}
.bottom-content {
min-height: 50px;
display: flex;
flex-wrap: wrap;
flex: auto;
background: black;
width: 100%;
color: white;
font-size: 20px;
justify-content: center;
align-items: center;
}
.main {
width: 100%;
max-width: 960px;
min-width: 430px;
display: flex;
flex: auto;
margin: auto;
box-sizing: border-box
}
.grid {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.griditem {
margin-bottom: 30px;
display: flex;
flex-basis: calc(33.33% - 20px * 2/3);
flex-wrap: wrap;
}
.img {
width: 200px;
height: 200px;
background-color: black;
margin: 0 auto;
}
.title {
text-align: center;
}
.grid-content {
flex: 0 1 100%;
}
.text {
text-align: center;
}
.footer {
width: 100%;
background-color: black;
max-width: 960px;
min-width: 460px;
margin: 0 auto;
padding: 15px;
color: white;
text-align: center;
}
.img {
color: white;
}
@media screen and (max-width: 800px) {
.contnet {
display: none
}
.griditem {
flex-wrap: nowrap;
flex-basis: 100%;
}
.img {
flex: 0 0 auto;
}
.griditem:nth-child(even) {
margin: 0 0 0 30px;
order: 2
}
.footer{
display: none
}
.griditem:nth-child(odd) {
margin: 0 30px 0 0;
}
}
<hrader class="header">
<a href="" class="logo">Logo</a>
<div class="contnet">Content</div>
<div class="bottom-content">2</div>
</hrader>
<main class="main">
<div class="grid">
<div class="griditem">
<div class="img">1</div>
<div class="grid-content">
<h1 class="title">Title</h1>
<p class="text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Distinctio neque magnam amet, praesentium vel illum error autem voluptatibus veniam consequuntur.</p>
</div>
</div>
</div>
<div class="grid">
<div class="griditem">
<div class="img">2</div>
<div class="grid-content">
<h1 class="title">Title</h1>
<p class="text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Distinctio neque magnam amet, praesentium vel illum error autem voluptatibus veniam consequuntur.</p>
</div>
</div>
</div> <div class="grid">
<div class="griditem">
<div class="grid-content">
<div class="img">3</div>
<h1 class="title">Title</h1>
<p class="text">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Distinctio neque magnam amet, praesentium vel illum error autem voluptatibus veniam consequuntur.</p>
</div>
</div>
</div>
</main>
<footer class="footer">
Footer
</footer>
Fiddle: https://jsfiddle.net/q9bcpr4L/