虚度人生

导航

必备的reset css

reset css这个话题是已经被炒了n遍的问题,关于为什么要reset,什么是reset css之类的问题,不在这边赘述。

有兴趣八卦的同学可以参考@岁月如歌Reset CSS 研究(八卦篇)

参考了不少资料,整理了一个准备自用的reset css,主要偷师于yuiReset CSS 研究(技术篇)

 

body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,/* structural elements */
dl,dt,dd,ul,ol,li,/* list elements */
pre,/* text formatting elements */
form,fieldset,legend,button,textarea,/* form elements */
th,td /* table elements */ {
	margin: 0;
	padding: 0;
}

html {
	color: #000;
	background: transparent;
}

fieldset,img {
	border: 0;
}

/*because legend doesn't inherit in IE */
legend {
	color: #000;
}

body,button,input,select,textarea {
	font: 400 12px/1.5 arial, \5b8b\4f53, sans-serif;
}

button,input,select,textarea,table {
	margin: 5px;
	line-height: normal !important;	/* important is MUST to override the default style */
}

button,input,select {
	vertical-align: middle;
}

textarea {
	vertical-align: top;
}

h1,h2,h3,h4,h5,h6,strong {
	font-size: 100%;
	font-weight: 700;
}

h1,h2,h3 {
	margin: .5em 0;
}

h1 {
	font-size: 18px;
}

h2 {
	font-size: 16px;
}

h3 {
	font-size: 14px;
}

ul {
	list-style: none;
}

/* do not use padding here, vertical margins can be merged */
blockquote,ul,ol,dl {
	margin: .5em .5em .5em 2em;
}

dd {
	margin-left: 1em;
}

form {
	padding: 10px;
}

input[type=text],input[type=password],textarea {
	width: 12em;
}

button,a {
	cursor: pointer;
}

a {
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}

caption,th {
	text-align: center;
	padding: .2em;
}

th,td {
	border: 1px solid #000;
	padding: .2em;
}

既然没有银弹,就应该适用于自己,所以我去掉了'var, code'这一类的css,因为网站不会用到这些标签。

主要花时间比较多的部分是字体,觉得看@棕熊font family就差不多了,基本概括了其余文章里讲的内容。

然后关于行高的问题可参看这个ppt

所以取了1.5的行高,由于Helvetica的怪异性,舍弃了Helvetica,采用了绝大多数都支持的Arial,再加入一个宋体。

posted on 2010-01-14 16:49  nozer0  阅读(493)  评论(0编辑  收藏  举报