简体   繁体   中英

Possible to use width=device-width and meta name=“viewport” content=“width=1024”?

In my header php in wordpress can I add both viewports:

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

and

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

I want to be able to say everything displays using viewport width 1024 , unless you are a mobile device below x pixels then use width=device-width instead.

Is this possible?

Thanks

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

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

you can try the following code

/* #### 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 */
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM