HTML自适应手机屏

时间:2022-04-22
本文章向大家介绍HTML自适应手机屏,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

在HTML里面 <head></head> 之间加入

 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
 <meta name="format-detection"content="telephone=no">
 <meta name="apple-mobile-web-app-capable" content="yes" />
 <meta name="apple-mobile-web-app-status-bar-style" content="black" />
 <style type="text/css">*{margin:0;padding:0; border:0;}</style> 

特别要注意: 自适应屏幕以后,所有字体不可用 像素(px) ,否则字体将会很大或者很奇怪,可以用 em 来调节字体大小。