【发布时间】:2014-05-19 04:10:45
【问题描述】:
我有两个媒体查询。一个用于手机,另一个用于平板电脑。他们都要求相同的样式。在这种情况下,保留此代码DRY 的最佳方法是什么?
$mobile-portrait: "only screen and (max-width: 680px)";
$tablet-portrait: "only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)";
div {
background: gray; margin: 0 auto; height: 50px; width: 50px;
@media #{$mobile-portrait} {
height: 100px; width: 100px;
}
@media #{$tablet-portrait} {
height: 100px; width: 100px;
}
}
【问题讨论】:
标签: html css sass media-queries