<随笔> 手机端兼容 css
<!-- ==========================================>[强制让文档的宽度与设备的宽度保持1:1,而且文档最大的宽度比例是1.0,且不容许用户点击屏幕放大浏览;] --> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"name="viewport"> <!-- ==========================================>[iphone设备中的safari私有meta标签,它表示:容许全屏模式浏览;] --> <meta content="yes" name="apple-mobile-web-app-capable"> <!-- ==========================================>[iphone的私有标签,它指定的iphone中safari顶端的状态条的样式;] --> <meta content="black" name="apple-mobile-web-app-status-bar-style"> <!-- ==========================================>[告诉设备忽略将页面中的数字识别为电话号码] --> <meta content="telephone=no" name="format-detection">
/* CSS属性初始化 */ html, body { font-size: 14px; font-family: "Microsoft Yahei",sans-serif; /*移动端默认的字体*/ width: 100%; height: 100%; /* 禁用iPhone中Safari的字号自动调整 */ -webkit-text-size-adjust: none; } /* 设置HTML5元素为块 */ ::before, ::after, article, aside, details, figcaption, figure, header, footer, hgroup, menu, nav, section { display: block; /*清除移动端默认的tap点击的高亮效果*/ -webkit-tap-highlight-color: transparent; /*设置咱们全部的 宽度从border开始计算*/ -webkit-box-sizing: border-box; box-sizing: border-box; } /* 设置图片视频等自适应调整 */ img { max-width: 100%; height: auto; width: auto\9; /* ie8 */ } .video embed, .video object, .video iframe { width: 100%; height: auto; } ul, ol { list-style: none; } a { text-decoration: none; } input,textarea{ border: 0; resize: none; outline: none; /*只对ios 浏览器 清除默认样式*/ -webkit-appearance: none; } /*清除浮动*/ .clearfix::before, .clearfix::after{ content: "."; display: block; height: 0; line-height: 0; visibility: hidden; clear: both; } .fl{ float: left; } .fr{ float: right; } /* 定义统一的背景样式都加icon_ */ [class^="icon_"]{ background: url("../images/sprites.png") no-repeat; background-size: 200px 200px; } /* 动画 */ @keyframes jump { 0%{ transform: translateY(-300px); -webkit-transform: translateY(-300px); } 25%{ transform: translateY(-300px); -webkit-transform: translateY(-300px); } 50%{ transform: translateY(-300px); -webkit-transform: translateY(-300px); } 75%{ transform: translateY(-300px); -webkit-transform: translateY(-300px); } 100%{ transform: translateY(-300px); -webkit-transform: translateY(-300px); } } .jump { animation: jump 1s ease; }