I am trying to get my flexbox to resize on mobile devices and window size.
For the life of me I have no idea why it is not working. The flexbox should resize and wrap around to the next row as the browser scales down.
Demo
![]()
CSS/HTML
#flex-container {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: left;
width: 1000px;
height: 400px;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
background-color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
overflow: hidden;
}
#left-zone {
background: #fff;
height: 75%;
flex-grow: 0;
display: flex;
width: 350px;
align-items: center;
justify-content: left;
min-width: 0;
}
#left-zone .list {
display: flex;
list-style: none;
align-content: stretch;
flex-direction: column;
/* flex-grow: 1; */
flex: 1 1 calc(33.33% - 20px);
margin: 0;
padding: 0;
}
.item input {
display: none;
}
label {
display: block;
opacity: 0.5;
height: 50px;
text-align: center;
line-height: 50px;
}
label:hover {
opacity: 0.75;
cursor: pointer;
}
/* content slides in on the right side of the flexbox */
.content {
position: absolute;
left: 350px;
top: -400px;
width: 650px;
height: 400px;
-webkit-animation-duration: 0.75s;
animation-duration: 0.75s;
-webkit-animation-name: slideout;
animation-name: slideout;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
/* p tag content in the right side of the flexbox */
.content p {
max-width: 50%;
text-align: center;
}
#middle-border {
background-color: #eee;
height: 75%;
flex-grow: 1;
max-width: 2px;
z-index: 0;
}
/* Right side of flexbox where the content slides in */
#right-zone {
background-color: #ff000070;
height: 100%;
flex-grow: 3;
}
/* ==========Styles only related to the animation slidein: IGNORE============*/
@-webkit-keyframes slidein {
0% {
top: -400px;
opacity: 0;
}
100% {
opacity: 1;
top: 0;
}
}
@keyframes slidein {
0% {
top: -400px;
opacity: 0;
}
100% {
opacity: 1;
top: 0;
}
}
@-webkit-keyframes slideout {
0% {
top: 0;
opacity: 1;
}
100% {
top: -400px;
opacity: 0;
}
}
@keyframes slideout {
0% {
top: 0;
opacity: 1;
}
100% {
top: -400px;
opacity: 0;
}
}
input:checked ~ .content {
-webkit-animation-duration: 0.75s;
animation-duration: 0.75s;
-webkit-animation-name: slidein;
animation-name: slidein;
-webkit-animation-fill-mode: forwards;
animation-fill-mode: forwards;
-webkit-animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955);
animation-timing-function: cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
body {
background: #eee;
font-family: Tahoma;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta charset="utf-8">
<title>Flex Test</title>
</head>
<body>
<div id="flex-container">
<div id="left-zone">
<ul class="list">
<li class="item">
<input type="radio" id="radio_strawberries" name="basic_carousel" checked="checked" />
<label class="label_strawberry" for="radio_strawberries">strawberry</label>
<div class="content content_strawberry">
<h1>strawberry</h1>
<p>The garden strawberry... blah blah</p>
</div>
</li>
<li class="item">
<input type="radio" id="radio_banana" name="basic_carousel"/>
<label class="label_banana" for="radio_banana">banana</label>
<div class="content content_banana">
<h1>banana</h1>
<p>A banana... blah blah</p>
</div>
</li>
<li class="item">
<input type="radio" id="radio_apple" name="basic_carousel"/>
<label class="label_apple" for="radio_apple">apple</label>
<div class="content content_apple">
<h1>apple</h1>
<p>The apple... blah blah</p>
</div>
</li>
<li class="item">
<input type="radio" id="radio_orange" name="basic_carousel"/>
<label class="label_orange" for="radio_orange">orange</label>
<div class="content content_orange">
<h1>orange</h1>
<p>The orange... blah blah</p>
</div>
</li>
</ul>
</div>
<div id="middle-border"></div>
<div id="right-zone"></div>
</div>
</body>
</html>
I would like to make the right side wrap underneath the left side as the browser window resolution gets smaller, but I just can't seem to figure it out.
The content in the right side of the flexbox is hidden and simply slides in from the top using CSS keyframes. I am guessing that this might be an issue since the content div on the right side of the flexbox is essentially empty
CodePen
appreciate any help