2016-07-25 45 views
0

我使用低於LESS來定位手機和所有其他設備正在工作,但窗口手機位置:相對打破了整個用戶界面。CSS媒體查詢目標Windows Phone諾基亞Lumia

li { 
    @media screen and (max-width: 480px) { 
     position: relative; 
     top: 4px; 
     zoom: 0.5; 
     width: 46px; 
    } 
} 

如何僅針對使用媒體查詢的windows phone?

我已經通過下面的解決方案,但他們使用條件CSS標籤,我的項目使用LESS。

CSS to target Windows Phone 7

及以下解決方案的目標DPI,大概可能在將來改變的設備。因此這並不能解決我的問題。

@media query to target hi-res Windows Phone 8+?

+0

也許你的代碼不正確,在WinPhone上不起作用?解決位置問題:相對。 – 3rdthemagical

回答

0

我不會僅僅根據媒體查詢爲某個設備應用樣式時依賴。嘗試使用檢查庫is.js(http://is.js.org/#windowsPhone)就像這個例子:

if(is.windowsPhone()) { 
    $('body').addClass('is-windows-phone') 
} 
在您的樣式

現在你可以做這樣的事情:

body.is-windows-phone ul#fancyWindowsPhoneList li { 
    position: relative; 
    top: 4px; 
    zoom: 0.5; 
    width: 46px; 
} 

希望這有助於!