0
我試圖找出在sass中編寫媒體查詢的方法。這是我的代碼如何在sass中編寫媒體查詢?
devices: ("sphone","phone","tablet")
$breakpoints: (\t width2: ('sphone' : 320, 'phone' : 360, 'tablet' : 600), height2: ('sphone' : 509, 'phone' : 583, 'tablet' : 952))
=screen-width($device)
@each $name in $devices
@if $device != $name
@error "No device of such name"
$media: (max-width: map-get(map-get($breakpoints,"width2"),$device) + px)
@media screen only and ($media)
@content
\t \t
\t \t
.hello
background: #333
@include screen-width("mobile")
background: #444
我試圖編譯青菜一樣的,但它一直就扔我下面的錯誤。我不知道爲什麼。
Properties are only allowed within rules, directives, mixin includes, or other properties.
任何見解?
是的!這工作。謝謝 :) –