当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > HTML 5 Reset Stylesheet

HTML/XHTML教程
ie7打开页面有源文件但页面空白问题的解决方法
firefox支持webdings字体的方法
HTML 相对路径和绝对路径区别分析
ie6 失真问题
关闭IE启用图片工具列
HTML5 Canvas 起步(1) - 基本概念
网页表单元素Input的高级用法11例
漂亮样式表在XHTML+CSS网页制作中的应用
html ReadOnly 和 Enabled 区别
如何正确地在XHTML文档中使用JavaScript和CSS
IE6 为什么最多人使用
给网站添加 favicon的技巧 网址前面的小图标
什么是 WML?
WML 标签汇总
HTML相对路径 上级目录及下级目录的写法
html 自定义标签使用实现方法
Firefox下英文字母不换行的解决方案
HTML 文本转义小窍门
设置IE8使用IE7的样式的代码
HTML 标记一定不要忘记关闭

HTML/XHTML教程 中的 HTML 5 Reset Stylesheet


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 44 ::
收藏到网摘: n/a

这份css reset是在Eric Meyers的 CSS reset基础上修改出来的,特别针对HTML5调整了相应标签的初始化样式。

/*
html5doctor.com Reset Stylesheet
v1.4
2009-07-27
Author: Richard Clark - http://richclarkdesign.com
*/

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, dialog, figure, footer, header,
hgroup, menu, nav, section,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
line-height:1;
}

article, aside, dialog, figure, footer, header,
hgroup, nav, section {
display:block;
}

nav ul {
list-style:none;
}

blockquote, q {
quotes:none;
}

blockquote:before, blockquote:after,
q:before, q:after {
content:”;
content:none;
}

a {
margin:0;
padding:0;
border:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}

ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}

mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}

del {
text-decoration: line-through;
}

abbr[title], dfn[title] {
border-bottom:1px dotted #000;
cursor:help;
}

table {
border-collapse:collapse;
border-spacing:0;
}

hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}

input, select {
vertical-align:middle;
}

更新什么内容?
移除了那些在HTML5中不被赞成使用的标签样式,例如<acronym><font><big>……添加了HTML5新增标签样式,移除了默认的padding、margin和border,确定指定了那些本应该当做块级元素来显示的元素的display属性为block。

使用了属性选择器

为<abbr><dfn>元素添加了属性选择器,这是为了在这两个元素有title这个属性的时候为他们指定一个样式,这点是从可访问性的角度考虑的。

讨论

在锚点上添加outline:0有很严重的可访问性问题,直接导致键盘导航失效。

ins, mark在没有设置字体颜色的时候不必添加背景颜色。

更多内容猛点这里:http://html5doctor.com/html-5-reset-stylesheet/