可以使用width = device-width和meta name =“viewport”content =“width = 1024”?

时间:2013-03-11 13:13:34

标签: php css wordpress media-queries

在我的标题中,我可以在wordpress中添加两个视口:

<meta name="viewport" content="width=device-width" /> 

<meta name="viewport" content="width=1024" />

我希望能够使用everything显示viewport width 1024显示,除非您是x像素以下的移动设备,否则请使用width=device-width

这可能吗?

由于

2 个答案:

答案 0 :(得分:1)

对于好plugin,它将类似于:

<meta name="viewport" content="width=<?php echo  (is_mobile()) ? "device-width" : "width=1024" ?>" />

答案 1 :(得分:0)

您可以尝试以下代码

/* #### Mobile Phones Portrait #### */
@media screen and (max-device-width: 480px) and (orientation: portrait){
/* some CSS here */
}

/* #### Mobile Phones Landscape #### */
@media screen and (max-device-width: 640px) and (orientation: landscape){
/* some CSS here */
}

/* #### Mobile Phones Portrait or Landscape #### */
@media screen and (max-device-width: 640px){
/* some CSS here */
}

/* #### iPhone 4+ Portrait or Landscape #### */
@media screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2){
/* some CSS here */
}

/* #### Tablets Portrait or Landscape #### */
@media screen and (min-device-width: 768px) and (max-device-width: 1024px){
/* some CSS here */
}

/* #### Desktops #### */
@media screen and (min-width: 1024px){
/* some CSS here */
}