---
title: "html 样式原则"
author: "xjw1987524"
date: "2014-08-06T23:12:33Z"
tags: []
categories: ["Web前端"]
slug: "html"
draft: false
lastmod: "2014-08-06T23:40:18Z"
id: 2101141
url: "https://fishlovefly.iteye.com/blog/2101141"
---

**标签的样式初始化遵循一个原则：**

但凡是浏览默认的样式，都不要使用

各位可以看看各大网站的源代码就知道啦。

body,dl,dd,p,h1,h2,h3,h4,h5,h6{margin:0;font-size:12px;}

ol,ul{margin:0;padding:0;list-style:none;}

a{text-decoration:none;}

 

img{border:none;}

 

下面的是从淘宝复制出来的。

blockquote, body,button, dd, dl, dt, fieldset, form, h1, h2, h3, h4,h5, h6, hr, input, legend, li, ol, p, pre, td,textarea, th, ul {

1. margin: 0;
2. padding: 0;

}

body, button, input,select, textarea {

1. font: 12px/1.5 tahoma,arial,'Hiragino Sans GB',\\5b8b\\4f53,sans-serif;

}

再说明一次块状元素与内联元（from miaov）

**块状元素：**默认独占一行 ，没有宽度时，默认撑满一排   支持所有css命令

**内嵌(内联、行内)的特征**  同排可以继续跟同类的标签  内容撑开宽度  不支持宽高 不支持上下的margin和padding  代码换行被解析

Inline-block的特点和问题 

1、块在一行显示；

2、行内属性标签支持宽高；

3、没有宽度的时候内容撑开宽度

问题：

1、代码换行被解析---换行的距离是字体的一半（空格）；

2、ie6 ie7 不支持块属性标签的inline-block;