移动端网页的宽度 就是 屏幕宽度 , 不需要设置版心宽度 , 但是 页面必须进行尺寸适配 , 这就引入了如下几种页面布局方式 :
在上一篇 【移动端网页布局】移动端网页布局基础概念 ⑨ ( webkit 内核 | 移动端网页 CSS 初始化 - normalize.css ) 博客中 , 介绍了 webkit 浏览器的页面初始化样式文件 , 在 <head>
标签中 , 引入该样式 ;
<head>
<link rel="stylesheet" href="css/normalize.css" type="text/css">
</head>
<a>
链接在手机网页中 , 点击会有高亮效果 , 一般情况下药取消该效果 ;
a {
/* 取消链接点击时的高亮效果 */
-webkit-tap-highlight-color: transparent;
}
在手机端 , 长按 图片标签 / 链接标签 会弹出菜单 , 该样式也需要禁用 ;
img,
a {
/* 禁用 长按弹出菜单 */
-webkit-touch-callout: none;
}
在 iOS 手机中 , 按钮会有自定义的高亮样式 , 按钮样式一般都是自己设计的 , 不使用默认样式 ;
input {
/* 设置 iOS 取消按钮的自定义样式 */
-webkit-appearance: none;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>webkit 初始化</title>
<link rel="stylesheet" href="css/normalize.css" type="text/css">
<style>
a {
/* 取消链接点击时的高亮效果 */
-webkit-tap-highlight-color: transparent;
}
img,
a {
/* 禁用 长按弹出菜单 */
-webkit-touch-callout: none;
}
input {
/* 设置 iOS 取消按钮的自定义样式 */
-webkit-appearance: none;
}
div {
/* 设置 CSS3 盒子模型样式 */
box-sizing: border-box;
}
</style>
</head>
<body>
</body>
</html>
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有