Home > Backend Development > PHP Tutorial > 手机网站宽度自动适应手机屏幕

手机网站宽度自动适应手机屏幕

WBOY
Release: 2016-06-05 11:56:03
Original
1742 people have browsed it

其中:

width=device-width :表示宽度是设备屏幕的宽度

initial-scale=1.0 :表示初始的缩放比例

minimum-scale=0.5 :表示最小的缩放比例

maximum-scale=2.0 :表示最大的缩放比例

user-scalable=yes :表示用户是否可以调整缩放比例

如果希望打开网页就自动以原始比例显示,不允许用户修改的话,则将以上代码修改为:

1 <code class="keyword" style="margin:0px !important;padding:0px !important;outline:0px !important;float:none !important;vertical-align:baseline !important;position:static !important;left:auto !important;top:auto !important;right:auto !important;bottom:auto !important;height:auto !important;width:auto !important;line-height:1.1em !important;font-family:Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace !important;font-weight:bold !important;font-size:1em !important;min-height:auto !important;color:#006699 !important;background:none !important;">meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />

方法二:

把页面最顶部类似下面这段代码:

.......>

替换为:

1 ttp://www.wapforum.org/DTD/xhtml-mobile10.dtd" style="color:#FF0000;">http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template