1.html文件第一行要放Document Type, 以防浏览器使用Quirks模式来解析页面
"http://www.w3.org/TR/xhtml1/DTD/xhtml1/DTD/xhtml1-transitional.dtd" >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
2. <html>一定要有<head>和<body>。<head>里面一定要有<meta>(指的是指定此html编码的meta,如<meta http-equiv=”Content-Type” content=”text/html; charset=utf”>,且一定要作为<head>的第一个子元素,保证浏览器成功解析title的内容 )和<title>。
3.<p>里不能放block element,<blockquote>里一定要放block element。
4.<body>里只能放block element。
5.line-Height的用法
{
line-height : 1px ; /* 行宽1px */
line-height : 1em ; /* container及其decendents的行宽为container的font-size的1倍 */
line-height : 1 ; /* container的行宽为container的font-size的1倍
decendents的行宽为各自的font-size的1倍 */
}
6.<div>是block element,<span>是inline element。它们都是容器。
7.元素在xhtml里要写作闭合的。<br>要写成<br />或<br/>,如果“br”和“/”之间没加空格,老的浏览器可能不能识别。
8.两个block element上下接触的时候,上element的margin-bottom和下element的margin-top的最大值为两个element之间的距离。如果a元素在b元素上方,a元素的margin-bottom为13px,b元素的element的margin-top为5px,最大值为13px,所以a元素和b元素之间的距离为13px;
9.Floated elements are taken out of the normal flow and placed to the left or right.(浮动元素会从流中移除,放到左边或右边。)
10.Floated elements sit on top of block elements and don't affect their flow. However, the inline content respects the boundaries of a foated element and flows around it.(浮动元素如果出现在block element上方,是不会影响block element的流的,即原来该怎么样,还是怎么样。然而,inline element会尊重浮动元素的边界,即不会进入浮动元素范围内)
11.The clear property is used to specify that no foated elements can be on the left or right (or both) of a block element. A block element with clear set will move down until it is free of the block element on its side.(clear属性可以让浮动元素不会出现在block元素的左边、右边(或两者兼有)。)
12. A foated element must have a specifc width set to a value other than auto. (浮动元素必须指定宽度。)
13.If an absolutely positioned element is nested within another positioned element, then its position is relative to the containing element that is positioned.(如果一个设置了position属性的元素嵌套在另一个设置了position属性的元素内,则它的position是相对于包含着它的元素的position。)
14.When using relative positioning, left, right, top, and bottom refer to the amount of offset from the element’s position in the normal flow.(不像absolute和fixed,relative的元素仍然在流中,只是在元素显示前,浏览器移动了它的位置)