CSS reset CSS重置,YAHOO的YUI CSS RESET
每一个浏览器都有自己默认的设置,基础CSS重置可以删除浏览器提供的HTML元素的不一致样式。这创造了一个可靠的平坦的基础。加载CSS重置,编写您的项目需要的显式CSS。
当浏览器在元素的margins,line-heights,padding这些赋值的时候。如果时刻都写入布局中,网站会显得很粗糙。
这个reset方式很简单,并且极其的好用。它覆盖了所有浏览器的默认值,并且使各个浏览器都使用同样的数值。大量的使用 *{margin:0;padding:0}的时代已经过去了。使用reset可以更加的深入程序逻辑中。
官网:https://yuilibrary.com/yui/docs/cssreset/
cssreset.css
未压缩版:http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset.css
压缩版:
<link rel = “stylesheet” type = “text / css” href = “http://yui.yahooapis.com/3.18.1/build/cssreset/cssreset-min.css” >
/* YUI 3.18.1 (build f7e7bcb) Copyright 2014 Yahoo! Inc. All rights reserved. Licensed under the BSD License. http://yuilibrary.com/license/ */ /* TODO will need to remove settings on HTML since we can't namespace it. TODO with the prefix, should I group by selector or property for weight savings? */ html{ color:#000; background:#FFF; } /* TODO remove settings on BODY since we can't namespace it. */ /* TODO test putting a class on HEAD. - Fails on FF. */ body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin:0; padding:0; } table { border-collapse:collapse; border-spacing:0; } fieldset, img { border:0; } /* TODO think about hanlding inheritence differently, maybe letting IE6 fail a bit... */ address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal; } ol, ul { list-style:none; } caption, th { text-align:left; } h1, h2, h3, h4, h5, h6 { font-size:100%; font-weight:normal; } q:before, q:after { content:''; } abbr, acronym { border:0; font-variant:normal; } /* to preserve line-height and selector appearance */ sup { vertical-align:text-top; } sub { vertical-align:text-bottom; } input, textarea, select { font-family:inherit; font-size:inherit; font-weight:inherit; *font-size:100%; /*to enable resizing for IE*/ } /*because legend doesn't inherit in IE */ legend { color:#000; } /* YUI CSS Detection Stamp */ #yui3-css-stamp.cssreset { display: none; }