当一个块在另一个块下移动时,如何为小屏幕上的某些元素设置不同的样式?例如:make first block red。
<style type="text/css">
#block1 {
background: skyblue;
}
#block2 {
background: yellow;
}
/*
#block1 on small screen {
background: red;
}
*/
</style>
<div class="uk-grid">
<div id="block1" class="uk-width-small-2-3">
BLOCK 1
</div>
<div id="block2" class="uk-width-small-1-3">
BLOCK 2
</div>
</div>
答案 0 :(得分:2)
这有用吗?
#block1 {
background: skyblue;
}
#block2 {
background: yellow;
}
@media screen and (max-width: 480px) {
#block1 {
background: red;
}
}