1

我有一个媒体查询和相应的 CSS,它在屏幕右侧为桌面用户设置了一个工具集,在底部为移动用户设置了一个工具集。但是,它会覆盖 CSS 属性并将 0 分配给“左”和“右”。我做错了什么?请看下面萤火虫的截图。

在此处输入图像描述

这是我的媒体标签:

 /* 
- Binds all layouts together with imports and mediaqueries.
*/

//@import "libs/reset.less";

@import "mediaqueries/global.less";
@import "mediaqueries/desktop.less";
@import "mediaqueries/mobile.less";



@media only screen and (min-width: 480px) {
.mqMobile; /* Use mix-in to make sure that the styles are expanded inside the     mediaquery */
}

@media only screen and (min-width: 992px) {
.mqDesktop; /* Use mix-in to make sure that the styles are expanded inside the    mediaquery */
}
4

2 回答 2

4

For the mobile media query, use right: auto. This should override the normal CSS, and switch the right property from 0 without actually specifying a specific value. For example:

@media only screen and (min-width: 480px) {
    .mqMobile {
        left: 0;
        right: auto;
    }
}
于 2013-04-17T17:45:50.263 回答
0

您需要在您的 css 文件中添加媒体查询。

这将针对所有

    #toolset{
      float:left;
    }

这将针对移动

@media only screen and (max-device-width: 480px) {

     #toolset{
        float:right;
     }

}

参考这个:

http://css-tricks.com/snippets/css/media-queries-for-standard-devices/

于 2013-04-17T17:49:17.800 回答