3 回答

TA貢獻1872條經驗 獲得超4個贊
orientation
您可以在媒體查詢中使用:
@media screen and (orientation:portrait) { [... your CSS rules for portrait mode here ...] }

TA貢獻1831條經驗 獲得超10個贊
彎曲方向列+環繞可以幫助檢測下面的可用空間。
.main {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100vh;
}
.pink {
background-color: pink;
padding-bottom: 55%;
}
.yellow {
background-color: yellow;
}
<div class="main">
<div class="pink"></div>
<div class="yellow">Text</div>
</div>

TA貢獻1998條經驗 獲得超6個贊
.flexcontainer {
display: flex;
flex-direction: row;
}
.pink {
width: 80%;
background: pink;
}
.yellow {
width: 20%;
background: yellow;
}
@media (max-width: 1000px) {
.flexcontainer {
flex-direction: column;
}
.pink {
width: 100%;
}
.yellow {
width: 100%;
}
}
<div class="flexcontainer">
<div class="pink">Test</div>
<div class="yellow">Text</div>
</div>
@media query
是的,當您必須使用不同的屏幕尺寸和方向并且您不希望將此邏輯內聯到元素上時,您當然需要。您需要確定元素應占據整個寬度的寬度。
- 3 回答
- 0 關注
- 169 瀏覽
添加回答
舉報