[英]website mobile compatibility
如何制作應與桌面瀏覽器兼容的網站以及移動瀏覽器?
有桌面和移動的替代CSS文件的訣竅。 因此在HTML標題中實現:
<head>
<meta name="viewport" content="width=320" />
<link rel="stylesheet" href="mobile.css" type="text/css" media="only screen and (max-device-width: 480px)"/>
<link rel="stylesheet" href="desktop.css" type="text/css" media="screen and (min-device-width: 481px)"/>
<link rel="stylesheet" href="mobile.css" type="text/css" media="handheld"/>
<!--[if IE]>
<link rel="stylesheet" href="desktop.css" media="screen" type="text/css" />
<![endif]-->
</head>
然后,如果您需要移動和桌面的替代內容,請隨意在桌面上顯示HTML的一部分並隱藏在移動設備上,反之亦然。
試過iPhone和Android。 需要注意的是簡單地指定“媒體=”手持式“”在裁判標簽或CSS文件不會做的伎倆; iPhone並不認為自己是掌上電腦。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.