There is one li element which I want to hide such that later I can apply special transition effect of expanding out. However, I still can't wrap my head around why max-width:0 works in this case while width:0 doesn't(the space occupied just disappears). I checked the property of width, max-width, min-width in dev tool and found out min-width is defaulting to auto greater than the 0 value of width and max-width. According to the spec on MDN, shouldn't min-width:auto wins?(which means the max-width:0 shouldn't take any effect).
Here is the link to the codepen
&__logo {
color: black;
// width:0 doesn't work
max-width: 0;
overflow: hidden;
background: white;
transition: all 0.5s;
font-weight: 600;
font-size: 30px;
}
CodePudding user response:
this flex property is messing with what you're attempting to do here
&__list-item {
text-align: center;
display: flex;
/* flex: 1; */
//if you comment out the line above it should work
fine i guess
justify-content: center;
align-items: center;
}