這是如何實現你想要的斷點青菜什麼(斷點,上海社會科學院亭子包)。 我試過它在鉻(並與網頁開發工具模擬設備),它的工作原理。
// With third-party tool
// Breakpoint https://github.com/at-import/breakpoint
// You can find installation instructions here https://github.com/at-import/breakpoint/wiki/Installation
$mobile-landscape-breakpoint: 'only screen' 375px 667px, (-webkit-min-device-pixel-ratio 2), (orientation landscape);
body {
@include breakpoint($mobile-landscape-breakpoint) {
color: blue;
}
}
如果斷點看起來太複雜了,您可以使用自己的代碼實現此目的。 例如:
// With Variable
$mobileLandscape: "only screen and (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape)";
@media #{$mobileLandscape} {
body {
color: red;
}
}
// With Mixin
@mixin mq($breakpoint){
@if $breakpoint == "mobile-landscape"{
@media only screen and (min-device-width: 375px) and (max-device-width: 667px) and (-webkit-min-device-pixel-ratio: 2) and (orientation: landscape){
@content;
}
}
}
body{
@include mq("mobile-landscape"){
color: green;
}
}
不,不工作,使用斷點不針對移動景觀的第一個唯一的,它的目標是每個手機和平板電腦。 第二種解決方案不使用gulp-sass進行編譯。 但是,當它使用媒體查詢時,它工作正常,我只想使用此媒體查詢的快捷方式,就是這樣,所以我問如何使用斷點來實現此快捷方式。 – Ruby
mixin解決方案似乎工作的方式,但我只是抓我的頭,如何與斷點? 必須離開。 – Ruby