<隨筆> 手機端兼容 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; }