Normalize.css.doc_第1页
Normalize.css.doc_第2页
Normalize.css.doc_第3页
Normalize.css.doc_第4页
Normalize.css.doc_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Normalize.css 是一个轻量级的CSS跨浏览器解决方案,包括移动浏览器。它提供了一套默认的样式,使得元素在大部分浏览器中具有相同的外观。Normalize.css基于最新的HTML5规范,相比较传统的css reset更具现代性。 Normalize.css目前的版本是2.1.3,代码和注释总共406行。目录 11行:文件说明行 254行:HTML5标签display样式统一,主要是兼容IE8/9的样式。 5580行:html和body标签的reset 80108行:a元素样式设置 109222行:布局元素的样式重置 223255行:设置内嵌元素样式 255394:设置form相关元素的样式 395407行:设置table元素样式11行:文件说明行?1/*! normalize.css v2.1.3 | MIT License | git.io/normalize */254行:HTML5标签display样式统一,主要是兼容IE8/9的样式。?12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152/* =HTML5 display definitions= */* Correct block display not defined in IE 8/9.*/article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary display: block;/* Correct inline-block display not defined in IE 8/9.*/audio,canvas,video display: inline-block;/* Prevent modern browsers from displaying audio without controls.* Remove excess height in iOS 5 devices.*/audio:not(controls) display: none;height: 0;/* Address hidden styling not present in IE 8/9.* Hide the template element in IE, Safari, and Firefox 22.*/hidden,template display: none;audio标签如果没用控制栏,则应该隐藏;hidden属性是在HTML5中新加入的属性,可能有些人觉得和规范一直倡导的样式分离有所背离,但HTML5设计的一条重要的原理就是实用性。这个属性会帮助屏幕阅读器更方便地识别。template标签用于HTML模板,现代Web开发中,HTML模板使用很多,这个标签是顺应实际需求。但模板又要求不能在界面上显示的,所以统一样式,兼容旧浏览器。5580行:html和body标签的reset?1234567891011121314151617181920212223/* =Base= */* 1. Set default font family to sans-serif.* 2. Prevent iOS text size adjust after orientation change, without disabling* user zoom.*/html font-family: sans-serif; /* 1 */-ms-text-size-adjust: 100%; /* 2 */-webkit-text-size-adjust: 100%; /* 2 */* Remove default margin.*/body margin: 0;在html标签上设置了text-size-adjust。这个规则并不是标准规范中定义的规则,所以应该加上浏览器前缀。 并且这个规则一般会在智能机上起作用。目前支持较好的是IE mobile和Safari mobile。设置此规则的目的是让文字在设备中更可读。body元素默认有margin样式,在一般情况下并不需要这个样式。80108行:a元素样式设置?12345678910111213141516171819202122232425262728/* =Links= */* Remove the gray background color from active links in IE 10.*/a background: transparent;/* Address outline inconsistency between Chrome and other browsers.*/a:focus outline: thin dotted;/* Improve readability when focused and also mouse hovered in all browsers.*/a:active,a:hover outline: 0;去掉了a元素的背景,统一了获得焦点时的外框,去掉了点击时或者鼠标进入时的外框。 个人不喜欢获得焦点时的外框。109222行:布局元素的样式重置?123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113/* =Typography= */* Address variable h1 font-size and margin within section and article* contexts in Firefox 4+, Safari 5, and Chrome.*/h1 font-size: 2em;margin: 0.67em 0;/* Address styling not present in IE 8/9, Safari 5, and Chrome.*/abbrtitle border-bottom: 1px dotted;/* Address style set to bolder in Firefox 4+, Safari 5, and Chrome.*/b,strong font-weight: bold;/* Address styling not present in Safari 5 and Chrome.*/dfn font-style: italic;/* Address differences between Firefox and other browsers.*/hr -moz-box-sizing: content-box;box-sizing: content-box;height: 0;/* Address styling not present in IE 8/9.*/mark background: #ff0;color: #000;/* Correct font family set oddly in Safari 5 and Chrome.*/code,kbd,pre,samp font-family: monospace, serif;font-size: 1em;/* Improve readability of pre-formatted text in all browsers.*/pre white-space: pre-wrap;/* Set consistent quote types.*/q quotes: 201C 201D 2018 2019;/* Address inconsistent and variable font size in all browsers.*/small font-size: 80%;/* Prevent sub and sup affecting line-height in all browsers.*/sub,sup font-size: 75%;line-height: 0;position: relative;vertical-align: baseline;sup top: -0.5em;sub bottom: -0.25em;重置了h1标签,没有重置其它标题标签,不明白。abbr标签的语义是表示缩小,在标签的title属性中会添加此缩写的完整版本。此标签在FF中默认有下边框(1px dotted),在Safari和Chrome中则无此样式,此处统一设置了下边框。在FF中,hr元素的默认样式很多,和其它浏览器主要的差异是设置了height为2px,box-sizeing为border-box,样式中正是重置了这两个影响布局的样式。mark标签是HTML5中的标签,IE8/9不支持,所以需要重置样式。pre标签的默认white-space样式为pre。white-space样式用于设置如何处理元素内的空白,默认值为normal,表示空格被浏览器忽略,如果要禁止文字自动换行,则设置值为nowrap;pre表示空白被浏览器保留,而pre-wrap表示空白被保留但正常换行。pre-line表示空白合并但保留换行。样式重置为pre-wrap应该更合理,当元素的宽度不够显示时文字折行。223255行:设置内嵌元素样式?123456789101112131415161718192021222324252627282930/* =Embedded content= */* Remove border when inside a element in IE 8/9.*/img border: 0;/* Correct overflow displayed oddly in IE 9.*/svg:not(:root) overflow: hidden;/* =Figures= */* Address margin not present in IE 8/9 and Safari 5.*/figure margin: 0;主要重置在IE浏览器中的样式。在旧版IE浏览器中,图片默认会出现一个蓝色的外框。255394:设置form相关元素的样式?123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139/* =Forms= */* Define consistent border, margin, and padding.*/fieldset border: 1px solid #c0c0c0;margin: 0 2px;padding: 0.35em 0.625em 0.75em;/* 1. Correct color not being inherited in IE 8/9.* 2. Remove padding so people arent caught out if they zero out fieldsets.*/legend border: 0; /* 1 */padding: 0; /* 2 */* 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,input,select,textarea font-family: inherit; /* 1 */font-size: 100%; /* 2 */margin: 0; /* 3 */* Address Firefox 4+ setting line-height on input using !important in* the UA stylesheet.*/button,input line-height: normal;/* Address inconsistent text-transform inheritance for button and select.* 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.*/button,select text-transform: none;/* 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,html inputtype=button, /* 1 */inputtype=reset,inputtype=submit -webkit-appearance: button; /* 2 */cursor: pointer; /* 3 */* Re-set default cursor for disabled elements.*/buttondisabled,html inputdisabled cursor: default;/* 1. Address box sizing set to content-box in IE 8/9/10.* 2. Remove excess padding in IE 8/9/10.*/inputtype=checkbox,inputtype=radio box-sizing: border-box; /* 1 */padding: 0; /* 2 */* 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).*/inputtype=search -webkit-appearance: textfield; /* 1 */-moz-box-sizing: content-box;-webkit-box-sizing: content-box; /* 2 */box-sizing: content-box;/* Remove inner padding and search cancel button in Safari 5 and Chrome* on OS X.*/inputtype=search:-webkit-search-cancel-button,inputtype=search:-webkit-search-decoration -webkit-appearance: none;/* Remove inner padding and border in Firefox 4+.*/button:-moz-focus-inner,input:-moz-focus-inner border: 0;padding: 0;/* 1. Remove default vertical scrollbar in IE

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论