带有 UIkit 的小屏幕样式

Style for small screen with UIkit

当一个块移动到另一个块下时,如何为小屏幕上的某些元素设置不同的样式?例如:将第一个方块设为红色。

<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>

jsfiddle

这有帮助吗?

Updated fiddle

#block1 {
    background: skyblue;
}

#block2 {
    background: yellow;
}

@media screen and (max-width: 480px) {  
  #block1 {
    background: red;
  }
}