css  默认样式重置

 @charset "utf-8";
*{margin:0;padding:0;}
img {border:none; display:block;}
em,i{ font-style:normal;}
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, textarea, p, blockquote, th, td, font { padding: 0; margin: 0; font-family:"微软雅黑"; }
table { border-collapse: collapse; border-spacing: 0;}
h1, h2, h3, h4, h5, h6 { font-weight: normal; font-size: 100%; }
ol, ul, li, dl, dt, dd { list-style: none; }
input, button, textarea, checkbox, select, radio, form { vertical-align: top; }
a{ color: #000; text-decoration: none; }
a:link, a:visited { text-decoration: none; }
a:hover{color:#cd0200;text-decoration:underline}
input[type="submit"], input[type="reset"], input[type="button"], button {
-webkit-appearance: none;
}
html,body{height:100%}

移动端适配   rem.js

/**
* YDUI 可伸缩布局方案
* rem计算方式:设计图尺寸px / 100 = 实际rem 例: 100px = 1rem
*/
!function (window) { /* 设计图文档宽度 */
var docWidth = 750; var doc = window.document,
docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize'; var recalc = (function refreshRem () {
var clientWidth = docEl.getBoundingClientRect().width; /* 8.55:小于320px不再缩小,11.2:大于420px不再放大 */
docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / docWidth), 11.2), 8.55) * 5 + 'px'; return refreshRem;
})(); /* 添加倍屏标识,安卓为1 */
docEl.setAttribute('data-dpr', window.navigator.appVersion.match(/iphone/gi) ? window.devicePixelRatio : 1); if (/iP(hone|od|ad)/.test(window.navigator.userAgent)) {
/* 添加IOS标识 */
doc.documentElement.classList.add('ios');
/* IOS8以上给html添加hairline样式,以便特殊处理 */
if (parseInt(window.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)[1], 10) >= 8)
doc.documentElement.classList.add('hairline');
} if (!doc.addEventListener) return;
window.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false); }(window);

  附:一个比较全面的css样式重置   https://blog.csdn.net/qq_35630674/article/details/96484307

移动端适配静态小demo (需引入上方css、rem.js)

css

 body{
display:flex;
flex-direction:column;
height:100%;
} /* head */
header{
height:1rem;
background:#0dc441;
display:flex;
justify-content:center;
align-items: center;
}
header span{
display:block;
width:1.5rem;
height:.5rem;
background:#64d985;
text-align:center;
line-height:.5rem;
color:#fff;
font-size:16px;
}
header span:nth-child(1){
border-radius:1rem 0 0 1rem
}
header span:nth-child(2){
border-radius: 0 1rem 1rem 0;
background:#3dd067;
color:#a3e9b7;
} /* nav */
nav{
height:1rem;
border-bottom:1px solid #d9d9d9;
display:flex;
}
nav li{
height:1rem;
flex:1;
text-align:center;
line-height:1rem;
font-size:14px;
color:#666;
}
nav .active{
border-bottom:2px solid #0dc441;
color:#0dc441;
}
.made{
flex:1;
overflow:auto;
}
article{
display:flex;
flex-wrap:wrap;
justify-content:space-between;
}
article figure{
width:49.2%;
border:1px solid #e5e5e5;
margin-bottom:0.42rem;
}
article figure img{
width:100%;
}
/* footer */
footer{
height:1rem;
background:pink;
}

html

 <body>
<!-- head -->
<header>
<span>孙行者</span>
<span>者行孙</span>
</header>
<!-- nav -->
<nav>
<li>孙悟空</li>
<li class="active">猪八戒</li>
<li>沙和尚</li>
</nav>
<!-- section -->
<div class="made">
<article>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
<figure>
<img src="5.jpg" alt="">
</figure>
</article>
</div>
<!-- footer -->
<footer> </footer>
</body>
</html>

css样式重置 移动端适配的更多相关文章

  1. css扁平化博客学习总结(二)css样式重置

    css样式重置 方法一:不推荐使用,这么写会让网页解析速度变慢. *{ margin: 0; padding: 0;} 方法二:大家常用的写法,比较流行. body, html, div, block ...

  2. 分享一下自己在用的CSS样式重置代码

    通过借鉴网上大牛们的经验和自己在工作中碰到的一些问题,总结出了这些比较常用的CSS样式重置的代码: @charset "utf-8"; /* 防止用户自定义背景颜色对网页的影响,添 ...

  3. 非常好用的CSS样式重置表

    非常好用的CSS样式重置表           我们在项目前期准备时都会准备好一个reset.css,因为不同浏览器对标签的解析各不相同,重置css样式可以让标签在不同浏览器下产生相同的效果.所以一个 ...

  4. css样式重置,不建议用通配符

    由于各个浏览器对css样式的默认样式不一致,所以有必要进行样式重置.在网上看到很多建议使用 *{margin:0;padding:0} 重置margin和padding.建议不这样子使用,原因主要是性 ...

  5. 常见网站CSS样式重置

    腾讯 1 2 3 4 5 6 7 8 9 body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea, ...

  6. css样式重置(初始化)收集

    淘宝的样式初始化: body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fields ...

  7. reset.css(样式重置)

    CSS Reset,意为重置默认样式.HTML中绝大部分标签元素在网页显示中都有一个默认属性值,通常为了避免重复定义元素样式,需要进行重置默认样式(CSS Reset).举几个例子:1.淘宝(CSS ...

  8. 封装好通用的reset.css base.css 样式重置css文件

    一般是叫reset.css 我这边命名成base.css 哎呀无所谓…… @charset "UTF-8"; /*css reset*/ /*清除内外边距*/ body, h1, ...

  9. css样式重置方案 -解决浏览器差异

    1.http://meyerweb.com/eric/tools/css/reset/ /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 2011 ...

随机推荐

  1. 【计算机网络】UDP基础知识总结

    1. UDP概念相关 [!NOTE] UDP(User Datagram Protocol),又叫用户数据报协议. UDP是一个无连接的.不可靠.基于数据报的传输协议.UDP只是报文(报文可以理解为一 ...

  2. 图解隐马尔可夫模型(HMM)

    写在前面 最近在写论文过程中,研究了一些关于概率统计的算法,也从网上收集了不少资料,在此整理一下与各位朋友分享. 隐马尔可夫模型,简称HMM(Hidden Markov Model), 是一种基于概率 ...

  3. 【干货】SqlServer 总结几种存储过程分页的使用

    就我而言写代码最烦的就是处理数据,其中之一就是分页的使用. 有的代码写多了,总结出一套适用自己的分页方法:有的查一下资料借鉴一下套用起来也达到目的. 那么小编在这里给大家总结几个方法供大家做一下参考. ...

  4. Docker实用debug调试技巧锦集

    阅读约 20 分钟 『重用』容器名 但我们在编写/调试Dockerfile的时候我们经常会重复之前的command,比如这种docker run --name jstorm-zookeeper zoo ...

  5. SpringMVC入门 -- 参数绑定

    一.REST与RESTful 1.简介 (1)REST(Representational State Transfer):表现层状态转移,一种软件架构风格,不是标准.REST描述的是在网络中clien ...

  6. PHP代码篇(四)--将字符串按指定字符切割

    说,我有一个中间接手的需求,什么叫中间接手呢,就是这个功能已经上线了,并且已经产生数据了,现在要对这个功能进行修改,所以既要满足当下开发的需求,又要兼容以前的功能.简单说来,就是我们有一个后台添加商品 ...

  7. ctr预估论文梳理和个人理解

    问题描述 ctr的全称是click through rate,就是预估用户的点击率,可以用于推荐系统的ranking阶段.ctr预估可以理解为给用户的特征.item的特征以及context的特征(比如 ...

  8. 有 va_arg宏 中数组下标-1 引发的思考 - C 语言中内存模型

    va_arg宏,是头文件 stdarg.h 中定义的,获取可变参数的当前参数. #define va_arg(list, mode) ((mode*)(list+=sizeof(mode)))[-1] ...

  9. 【洛谷P4589】[TJOI2018]智力竞赛(二分+最小链覆盖)

    洛谷 题意: 给出一个\(DAG\),现在要选出\(n+1\)条可相交的链来覆盖,最终使得未被覆盖的点集中,权值最小的点的权值最大. 思路: 显然最终的答案具有单调性,故直接二分答案来判断: 直接将小 ...

  10. RabbitMQ学习笔记(一、消息中间件基础)

    目录: 什么是消息中间件 消息中间件的作用 JMS规范 AMQP协议 RabbitMQ简介 Hello World 什么是消息中间件: 消息中间件(Message Queue Middleware,简 ...