Last active
December 13, 2021 07:51
-
-
Save szy0syz/296d02bc783ac76f29c6e3f17df58c11 to your computer and use it in GitHub Desktop.
css-reset from 《HTML5布局之路》
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "utf-8"; /*表示定义CSS文件的字符编码格式为"utf-8"*/ | |
/*为HTML元素定义样式:字体颜色为黑色,背景颜色为白色,字体类型为"微软雅黑、sans-serif、Arial"三种*/ | |
html { | |
color: #000; | |
background: #fff; | |
font-family: 'Microsoft YaHei', sans-serif, Arial; | |
} | |
/*为body、div等元素设置内边距为零、外边距为零、字体类型为"微软雅黑、sans-serif、Arial"三种*/ | |
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td, strong { | |
padding: 0; | |
margin: 0; | |
font-family: 'Microsoft YaHei', sans-serif, Arial; | |
} | |
/*为table标签设置:合并单元格之间的边距。边框间距为零*/ | |
table { | |
border-collapse: collapse; | |
border-spacing: 0; | |
} | |
/*为img标签设置0像素的边距(因为img标签在a标签当中时,默认会有蓝色边框)*/ | |
img { | |
border: 0; | |
} | |
/*为a标签设置初始样式:没有下划线、字体颜色为#333(深灰色),在单击a标签时没有外侧的高亮线(outline)*/ | |
a { | |
text-decoration: none; | |
color: #333; | |
outline: none; | |
} | |
/*为a标签的hover状态设置样式:出现下画线*/ | |
a:hover { | |
text-decoration: underline; | |
} | |
/*为var、em。strong元素设置字体样式为"正常"*/ | |
var, em, strong { | |
font-style: normal; | |
} | |
/*为em、strong、th、var元素设置字体样式为"继承"、字体粗细为"继承",*/ | |
em, strong, th, var { | |
font-style: inherit; | |
font-weight: inherit; | |
} | |
/*此声明块和上一个声明块的设置方式,相当于先将网页中所有的var、em、strong标签的字体样式去除,之后,再设置样式继承父级样式,这样就能够保证其他标签中的var、em、strong标签的样式与其父级元素相同*/ | |
/*为li标签去除列表项的小标志*/ | |
li { | |
list-style: none; | |
} | |
/*为caption、th设置左对齐*/ | |
caption, th { | |
text-align: left; | |
} | |
/*为h1~h6的标签设置字体大小,均为父级元素的字体大小,且不做加粗处理(默认状态下不同的标题类元素大小不同,且均具有加粗效果)*/ | |
h1, h2, h3, h4, h5, h6 { | |
font-size: 100%; | |
font-weight: normal; | |
} | |
/*为input、button、textarea等元素设置字体类样式、字体的各种样式均继承父级样式*/ | |
input, button, textarea, select, optgroup, option { | |
font-family: inherit; | |
font-size: inherit; | |
font-style: inherit; | |
font-weight: inherit; | |
} | |
/*为input、button、textarea、select设置hack,为了在IE6和IE7下字体为父级的100%*/ | |
input, button, textarea, select { | |
*font-size: 100%; | |
} | |
/*清除浮动*/ | |
.clearfix:after { | |
content: "\200B"; | |
clear: both; | |
display: block; | |
height: 0; | |
} /*content:"\200B";这个参数,Unicode字符里有一个“零宽度空格”,即 U+200B,代替原来的“.”,可以缩减代码量。而且不再使用visibility:hidden*/ | |
.clearfix { | |
*zoom: 1; | |
} /*hack: IE7,6*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@charset "utf-8"; | |
html{color: #000;background: #fff;font-family: 'Microsoft YaHei',sans-serif,Arial;} | |
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td,strong{ | |
padding: 0;margin: 0;font-family: 'Microsoft YaHei',sans-serif,Arial;} | |
table{border-collapse: collapse;border-spacing: 0;} | |
img{border: 0;} | |
a{text-decoration: none;color: #333;outline: none;} | |
a:hover{text-decoration: underline;} | |
var, em, strong{font-style: normal;} | |
em,strong,th,var{font-style: inherit;font-weight: inherit;} | |
li{list-style: none;} | |
caption,th{text-align: left;} | |
h1,h2,h3,h4,h5,h6{font-size: 100%;font-weight: normal;} | |
input,button,textarea,select,optgroup,option{font-family: inherit;font-size: inherit;font-style: inherit;font-weight: inherit;} | |
input,button,textarea,select{*font-size: 100%;} | |
.clearfix:after{content:"\200B";clear: both; display: block;height: 0;} | |
.clearfix{*zoom: 1;} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment