我想隱藏一個li元素,以便稍后我可以應用擴展的特殊過渡效果。但是,我仍然無法理解為什么max-width:0在這種情況下有效而width:0無效(占用的空間就消失了)。我在開發工具中檢查了width、max-width、min-width的屬性,發現min-width默認為auto大于width和max-width的 0 值。根據 MDN 上的規范,不應該min-width:auto獲勝嗎?(這意味著max-width:0不應該產生任何影響)。
這是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;
}
uj5u.com熱心網友回復:
這個 flex 屬性搞亂了你在這里嘗試做的事情
&__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;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/445004.html
上一篇:角度如何凍結墊表
下一篇:準確檢測瀏覽器是否支持平滑滾動?
