diff --git a/normalize.css b/normalize.css index 5e79cf07c..8ffcbdd54 100644 --- a/normalize.css +++ b/normalize.css @@ -6,6 +6,8 @@ /** * Correct `block` display not defined in IE 8/9. + * 在IE8/9这种不支持Html5的浏览器里,要使用Html5的新标签,先用js创建这些元 + * 素,然后再把它们设置为块级元素, */ article, @@ -25,6 +27,7 @@ summary { /** * Correct `inline-block` display not defined in IE 8/9. + * 同上,设为内联块级 */ audio, @@ -35,7 +38,10 @@ video { /** * Prevent modern browsers from displaying `audio` without controls. + * 防止把没有controls属性的audio标签也显示出来,实际上在chrome30和FF20 + * 以上不使用reset都没有发现这个问题 * Remove excess height in iOS 5 devices. + * 在IOS5上去掉没有controls属性的audio标签的多余高度 */ audio:not([controls]) { @@ -45,7 +51,10 @@ audio:not([controls]) { /** * Address `[hidden]` styling not present in IE 8/9. + * 在IE8/9里正确隐藏含hidden属性的标签 * Hide the `template` element in IE, Safari, and Firefox < 22. + * 在上述浏览器里隐藏template标签,有关template请看 + * http://www.w3.org/TR/html-templates/ */ [hidden], @@ -55,12 +64,24 @@ template { /* ========================================================================== Base - ========================================================================== */ + 上面都是针对html5的reset,接下来是基本的reset +========================================================================== */ /** * 1. Set default font family to sans-serif. + * 优雅降级的最后一招?默认字体为sans-serif解决不同浏览器甚至不同语言环境 + * 不同OS下不同的默认字体出现各种千奇百怪的对不齐中英混排错乱的问题,为 + * 什么是sans-serif?其实这是个generic family代表字母没脚(无衬线)的字体 + * 另外还有serif和等宽两种generic family * 2. Prevent iOS text size adjust after orientation change, without disabling * user zoom. + * IOS5里竖屏转横屏时字体会放大,用webkit私有的这个属性100%解决,较新 + * 的桌面版本webkit不支持这个的哦,换言之这个东西就是用在safari上的。 + * 题外话新的chrome已经把webkit换成blink, + * 根据他们和mozillia的共识是私有属性都不应该再默认支持,而是用css属性的 + * 正式写法来写代码,并通过浏览器设置来打开对某些实验性css属性的支持。 + * 另外-ms-text-size-adjust这个就是诺基亚上的ie用的? + * http://dev.w3.org/csswg/css-size-adjust/ */ html { @@ -71,6 +92,8 @@ html { /** * Remove default margin. + * IE6/7和怪异模式下IE的毛病,浮动的块级元素如果margin是系统默认的就会丢 + * 掉上下边距 */ body { @@ -83,6 +106,7 @@ body { /** * Remove the gray background color from active links in IE 10. + * 不解释。 */ a { @@ -91,6 +115,9 @@ a { /** * Address `outline` inconsistency between Chrome and other browsers. + * 比如在tab切换时,焦点到了A身上,其他浏览器都是给一个虚线框给A的。 + * 而chrome是个橙色实线框。。。 + * http://necolas.github.io/normalize.css/和其他网站的区别 */ a:focus { @@ -99,6 +126,8 @@ a:focus { /** * Improve readability when focused and also mouse hovered in all browsers. + * 然后作者觉得鼠标划入焦点中的A应该把虚线框隐藏掉,划出再显示虚线框是 + * 个好主意,就动了这个手脚…… */ a:active, @@ -108,11 +137,19 @@ a:hover { /* ========================================================================== Typography + 好了,到了排版! ========================================================================== */ /** * Address variable `h1` font-size and margin within `section` and `article` * contexts in Firefox 4+, Safari 5, and Chrome. + * chrome30的h1设置默认就是这么大的,但是如果在section和article里就会变成 + * 相当于h2的大小,作者觉得所有浏览器还是要统一一下的就改了他 + * + * 实际上我不喜欢这个reset,因为section和article在排版上已经降低了一个级别, + * 所以里面的所有h(n)标签为了排版清晰自动降低一个级别为h(n+1)是完全make sense的, + * 要么像以前的版本全都还原,要么别动他 + * 是不是作者觉得去fix IE的排版错误还不如这样来得简单? */ h1 { @@ -122,6 +159,7 @@ h1 { /** * Address styling not present in IE 8/9, Safari 5, and Chrome. + * 给有title属性的abbt增加虚线下划线,像FF里显示的一样(作者真细心Orz) */ abbr[title] { @@ -130,6 +168,8 @@ abbr[title] { /** * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome. + * 这两个标签好像不怎么提倡用了吧……不过你们也太坏了直接就不出效果了, + * IE倒是很老实地继续粗体,chrome30 user agent默认设置很正确啊,旧版本的 * bug? */ b, @@ -138,7 +178,8 @@ strong { } /** - * Address styling not present in Safari 5 and Chrome. + * Address styling not present in Safari 5 and Chrome.‘ + * 同上,chrome30依旧冇问题 */ dfn { @@ -147,6 +188,18 @@ dfn { /** * Address differences between Firefox and other browsers. + * FF22的默认为:hr { + display: block; + height: 2px; + border: 1px inset; + margin: 0.5em auto 0.5em auto; + color: gray; + -moz-float-edge: margin-box; + -moz-box-sizing: border-box; +} + * 变成一只content-box,只按照content来计算元素尺寸,但仍然显示1像素的边 + * 框,主要是解决高度和其他浏览器不一致的问题?其他是0。 + * */ hr { @@ -157,6 +210,7 @@ hr { /** * Address styling not present in IE 8/9. + * 不解释。 */ mark { @@ -178,6 +232,7 @@ samp { /** * Improve readability of pre-formatted text in all browsers. + * 必要时换行 */ pre { @@ -186,6 +241,7 @@ pre { /** * Set consistent quote types. + * 引号也统一下 */ q { @@ -194,6 +250,7 @@ q { /** * Address inconsistent and variable font size in all browsers. + * 不解释 */ small { @@ -202,6 +259,7 @@ small { /** * Prevent `sub` and `sup` affecting `line-height` in all browsers. + * 这玩意儿还会影响行高?先缩小字体再在基线上调整高度 */ sub, @@ -226,6 +284,7 @@ sub { /** * Remove border when inside `a` element in IE 8/9. + * 恩没错,去掉那个难看的蓝色框 */ img { @@ -234,6 +293,7 @@ img { /** * Correct overflow displayed oddly in IE 9. + * 不懂 */ svg:not(:root) { @@ -246,6 +306,7 @@ svg:not(:root) { /** * Address margin not present in IE 8/9 and Safari 5. + * 其他有默认外边距的也都变成0了 */ figure { @@ -258,6 +319,7 @@ figure { /** * Define consistent border, margin, and padding. + * 又来统一一下!webkit是2px */ fieldset { @@ -268,7 +330,9 @@ fieldset { /** * 1. Correct `color` not being inherited in IE 8/9. + * 又是难看的蓝色 * 2. Remove padding so people aren't caught out if they zero out fieldsets. + * 对准fieldset */ legend { @@ -280,6 +344,7 @@ legend { * 1. Correct font family not being inherited in all browsers. * 2. Correct font size not being inherited in all browsers. * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome. + * 不解释 */ button, @@ -291,6 +356,17 @@ textarea { margin: 0; /* 3 */ } +/* +* Remove outline in Chomre又是橙色边框! +*/ +button:focus, +input:focus, +select:focus, +textarea:focus{ + outline:none; +} + + /** * Address Firefox 4+ setting `line-height` on `input` using `!important` in * the UA stylesheet. @@ -306,6 +382,9 @@ input { * All other form control elements do not inherit `text-transform` values. * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+. * Correct `select` style inheritance in Firefox 4+ and Opera. + * + *这个属性见https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform + * */ button, @@ -316,9 +395,11 @@ select { /** * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` * and `video` controls. + * 。。。 * 2. Correct inability to style clickable `input` types in iOS. * 3. Improve usability and consistency of cursor style between image-type * `input` and others. + * 加个手指形的鼠标样式给图片式按钮更和谐。 */ button, @@ -331,6 +412,7 @@ input[type="submit"] { /** * Re-set default cursor for disabled elements. + * 如果是禁用了,就干脆变回普通的指针(为明显为何不用叉掉的样式?) */ button[disabled], @@ -341,6 +423,8 @@ html input[disabled] { /** * 1. Address box sizing set to `content-box` in IE 8/9. * 2. Remove excess padding in IE 8/9. + * IE8/9又调皮了,所有方向都有3px的内边距,重置为零。将content-box改为border-box, + * 因为他们的border在useragent里默认是medium(3px),所以算上border的大小后盒子尺寸又和原来一样了 */ input[type="checkbox"], @@ -353,6 +437,7 @@ input[type="radio"] { * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome * (include `-moz` to future-proof). + * 看来作者是比较爱content-box啊 */ input[type="search"] { @@ -365,6 +450,7 @@ input[type="search"] { /** * Remove inner padding and search cancel button in Safari 5 and Chrome * on OS X. + * OSX,我木有。。。 */ input[type="search"]::-webkit-search-cancel-button, @@ -374,6 +460,7 @@ input[type="search"]::-webkit-search-decoration { /** * Remove inner padding and border in Firefox 4+. + * mozilla的按钮获取焦点后内还有个小小的虚线框,干掉他。 */ button::-moz-focus-inner, @@ -384,7 +471,10 @@ input::-moz-focus-inner { /** * 1. Remove default vertical scrollbar in IE 8/9. + * 去掉IE8/9那个难看的XX!again! * 2. Improve readability and alignment in all browsers. + * 统一下垂直对齐,可以参考下其他属性 + * http://www.w3schools.com/cssref/playit.asp?filename=playcss_vertical-align&preval=top */ textarea { @@ -398,6 +488,8 @@ textarea { /** * Remove most spacing between table cells. + * 去掉单元格间的缝隙,使用css2.1的属性border-collapse + * https://developer.mozilla.org/en-US/docs/Web/CSS/border-collapse */ table {