I'm using flexbox for the first time and I found one very pretty accordion which I need, but width of the inactive boxes makes me a big difficulties.
I have 5 boxes and ratio is 5:1:1:1:1, but inactive boxes are still too big. I want ratio like 15:1:1:1:1 or something like that. But if I increase width of active box, nothing gonna change. I repeat, i'm beginner in flexbox and, how much I understand it, when I increace ratio on active box, width of inactive boxes should be smaller.
Where I'm wrong?
* {
box-sizing: border-box;
/* border: 1px solid black; */
}
body {
font-family: 'Lato';
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizelegibility;
}
ul {
display: flex;
min-height: 100vh;
max-height: 100vh;
margin: 0;
padding: 0;
overflow: hidden;
list-style-type: none;
}
li {
flex: 1;
display: flex;
align-items: stretch;
padding: 20px;
background: #E74C3C;
cursor: pointer;
transition: all .5s ease;
&:hover {
background: darken(#E74C3C, 3);
}
&.active {
flex: 5;
background: #fff;
cursor: default;
h2 {
color: #E74C3C;
}
.section-content {
flex: 4;
opacity: 1;
transform: scaleX(1);
color: #E74C3C;
}
}
.section-title {
flex: 1;
display: flex;
align-items: center;
width: 100%;
margin: 0;
padding: 0;
text-align: center;
color: white;
h2 {
margin: 0;
transform: rotate(-90deg);
white-space: nowrap;
}
}
.section-content {
flex: 1;
display: flex;
align-items: center;
margin: 0;
padding: 0;
opacity: 0;
transition: all .25s .1s ease-out;
}
}
Here is my try and, I don't know why, JS doesn't wrok on this jsfiddle https://jsfiddle.net/CRooY3/krmjqa9r/1/