Skip to content

Instantly share code, notes, and snippets.

@JaHIY
Created June 21, 2012 12:45
Show Gist options
  • Save JaHIY/2965571 to your computer and use it in GitHub Desktop.
Save JaHIY/2965571 to your computer and use it in GitHub Desktop.
CSS:Another HTML5 reset stylesheet which merged with three different html5 reset css
@charset "utf-8";
/*
@名称: base
@功能: 重设浏览器默认样式
This HTML5 reset Stylesheet merged with the following HTML5 reset Stylesheets:
https://github.com/alipay/alice/blob/master/base.css
http://html5doctor.com/html-5-reset-stylesheet/
https://github.com/necolas/normalize.css/blob/master/normalize.css
*/
/* =============================================================================
HTML5 display definitions
========================================================================== */
/* 重设 HTML5 标签, IE 需要在 js 中 createElement(TAG) */
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary {
display:block;
}
/* HTML5 媒体文件跟 img 保持一致 */
audio,canvas,video {
display:inline-block;
*display:inline;
*zoom:1;
}
/*
* Prevents modern browsers from displaying 'audio' without controls
* Remove excess height in iOS5 devices
*/
audio:not([controls]) {
display:none;
height:0;
}
/*
* Addresses styling for 'hidden' attribute not present in IE7/8/9, FF3, S4
* Known issue: no IE6 support
*/
[hidden] {
display:none;
}
/* =============================================================================
Base
========================================================================== */
/* 内外边距通常让各个浏览器样式的表现位置不同 */
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,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
font-variant:normal;
vertical-align:baseline;
background:transparent;
}
/* 防止用户自定义背景颜色对网页的影响,添加让用户可以自定义字体 */
html{
color:#000;
-webkit-text-size-adjust:100%;
-ms-text-size-adjust:100%;
}
body {
line-height:1;
}
/* 要注意表单元素并不继承父级 font 的问题 */
body,button,input,select,textarea{
font:10px/1.5 "Tahoma","Arial",sans-serif;
}
input,select,textarea{
font-size:100%;
}
input,select {
vertical-align:middle;
}
/* 去除默认边框 */
fieldset{
border:0;
}
/* ie6 7 8(q) bug 显示为行内表现 */
iframe{
display:block;
}
/* 一致的 del 样式 */
del {
text-decoration:line-through;
}
address,caption,cite,code,dfn,em,th,var {
font-style:normal;
font-weight:500;
}
/* 对齐是排版最重要的因素, 别让什么都居中 */
caption,th {
text-align:left;
}
/* =============================================================================
Links
========================================================================== */
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
/*
* Addresses outline displayed oddly in Chrome
*/
a:focus {
outline:thin dotted;
}
/*
* Improves readability when focused and also mouse hovered in all browsers
* people.opera.com/patrickl/experiments/keyboard/test
*/
a:hover,a:active {
outline:0;
}
/* 让链接在 hover 状态下显示下划线 */
a:hover {
text-decoration:underline;
}
/* 默认不显示下划线,保持页面简洁 */
ins,a {
text-decoration:none;
}
/* =============================================================================
Typography
========================================================================== */
/* 来自yahoo, 让标题都自定义, 适应多个系统应用 */
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:500;
}
/*
* Addresses style set to 'bolder' in FF3+, S4/5, Chrome
*/
b,strong {
font-weight:500;
}
/*
* Corrects font family set oddly in IE6, S4/5, Chrome
* en.wikipedia.org/wiki/User:Davidgothberg/Test59
*/
pre,code,kbd,samp {
font-family:monospace,serif;
_font-family:'courier new',monospace;
font-size:1em;
}
/*
* Improves readability of pre-formatted text in all browsers
*/
pre {
white-space:pre;
white-space:pre-wrap;
word-wrap:break-word;
}
/*
* Addresses styling not present in IE7/8/9, S5, Chrome
*/
abbr[title],dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
/*
* 1. Addresses CSS quotes not supported in IE6/7
* 2. Addresses quote property not supported in S4
*/
/* 1 */
blockquote,q {
quotes:none;
}
/* 2 */
blockquote:before,blockquote:after,q:before,q:after {
content:'';
content:none;
}
small {
font-size:75%;
}
/*
* Prevents sub and sup affecting line-height in all browsers
* gist.github.com/413930
*/
sub,sup {
font-size:75%;
line-height:0;
position:relative;
vertical-align:baseline;
}
sup {
top:-0.5em;
}
sub {
bottom:-0.25em;
}
/* =============================================================================
Lists
========================================================================== */
/*
* Corrects list images handled incorrectly in IE7
*/
nav ul,nav ol {
list-style:none;
list-style-image:none;
}
/* =============================================================================
Embedded content
========================================================================== */
/*
* 1. Removes border when inside 'a' element in IE6/7/8/9, FF3
* 2. Improves image quality when scaled in IE7
* code.flickr.com/blog/2008/11/12/on-ui-quality-the-little-things-client-side-image-resizing/
*/
img {
border:0; /* 1 */
-ms-interpolation-mode:bicubic; /* 2 */
}
/*
* Corrects overflow displayed oddly in IE9
*/
svg:not(:root) {
overflow:hidden;
}
/* =============================================================================
Forms
========================================================================== */
/*
* 1. Corrects color not being inherited in IE6/7/8/9
* 2. Corrects text not wrapping in FF3
*/
legend {
border:0; /* 1 */
white-space:normal; /* 2 */
}
/*
* Addresses FF3/4 setting line-height on 'input' using !important in the UA stylesheet
*/
button,
input {
line-height:normal;
}
/*
* 1. Improves usability and consistency of cursor style between image-type 'input' and others
* 2. Corrects inability to style clickable 'input' types in iOS
* 3. Removes inner spacing in IE7 without affecting normal text inputs
* Known issue: inner spacing remains in IE6
*/
button,input[type="button"],input[type="reset"],input[type="submit"] {
cursor:pointer; /* 1 */
-webkit-appearance:button; /* 2 */
*overflow:visible; /* 3 */
}
/*
* Re-set default cursor for disabled elements
*/
button[disabled],input[disabled] {
cursor:default;
}
/*
* 1. Addresses box sizing set to content-box in IE8/9
* 2. Removes excess padding in IE8/9
* 3. Removes excess padding in IE7
Known issue: excess padding remains in IE6
*/
input[type="checkbox"],input[type="radio"] {
box-sizing:border-box; /* 1 */
padding:0; /* 2 */
*height:13px; /* 3 */
*width:13px; /* 3 */
}
/*
* 1. Addresses appearance set to searchfield in S5, Chrome
* 2. Addresses box-sizing set to border-box in S5, Chrome (include -moz to future-proof)
*/
input[type="search"] {
-webkit-appearance:textfield; /* 1 */
-moz-box-sizing:content-box;
-webkit-box-sizing:content-box; /* 2 */
box-sizing:content-box;
}
/*
* Removes inner padding and search cancel button in S5, Chrome on OS X
*/
input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button {
-webkit-appearance:none;
}
/*
* Removes inner padding and border in FF3+
* www.sitepen.com/blog/2008/05/14/the-devils-in-the-details-fixing-dojos-toolbar-buttons/
*/
button::-moz-focus-inner,input::-moz-focus-inner {
border:0;
padding:0;
}
/*
* 1. Removes default vertical scrollbar in IE6/7/8/9
* 2. Improves readability and alignment in all browsers
*/
textarea {
overflow:auto; /* 1 */
vertical-align:top; /* 2 */
}
/* =============================================================================
Tables
========================================================================== */
/*
* Remove most spacing between table cells
*/
table {
border-collapse:collapse;
border-spacing:0;
}
/* IE bug fixed: th 不继承 text-align*/
th{
text-align:inherit;
}
/* =============================================================================
Methods
========================================================================== */
/* 清理浮动 */
.fn-clear::after {
visibility:hidden;
display:block;
font-size:0;
content:" ";
clear:both;
height:0;
}
.fn-clear {
zoom:1; /* for IE6 IE7 */
}
/* 隐藏, 通常用来与 JS 配合 */
body .fn-hide {
display:none;
}
/* 设置内联, 减少浮动带来的bug */
.fn-left,.fn-right {
display:inline;
}
.fn-left {
float:left;
}
.fn-right {
float:right;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment