0

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

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

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

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

这可能吗?

谢谢

4

2 回答 2

1

使用好的插件,它将类似于:

<meta name="viewport" content="width=<?php echo  (is_mobile()) ? "device-width" : "width=1024" ?>" />
于 2013-03-11T13:19:33.027 回答
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 */
}
于 2013-03-11T13:20:02.840 回答