head first html with css with xhtml 学习小笔记
1.html文件第一行要放Document Type, 以防瀏覽器使用Quirks模式來解析頁面
<!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?????"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>的第一個(gè)子元素,保證瀏覽器成功解析title的內(nèi)容?)和<title>。
?
3.<p>里不能放block element,<blockquote>里一定要放block element。
?
4.<body>里只能放block element。
?
5.line-Height的用法
#container{
????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”和“/”之間沒加空格,老的瀏覽器可能不能識(shí)別。
8.兩個(gè)block element上下接觸的時(shí)候,上element的margin-bottom和下element的margin-top的最大值為兩個(gè)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.(浮動(dòng)元素會(huì)從流中移除,放到左邊或右邊。)
?
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.(浮動(dòng)元素如果出現(xiàn)在block element上方,是不會(huì)影響block element的流的,即原來該怎么樣,還是怎么樣。然而,inline element會(huì)尊重浮動(dòng)元素的邊界,即不會(huì)進(jìn)入浮動(dòng)元素范圍內(nèi))
?
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屬性可以讓浮動(dòng)元素不會(huì)出現(xiàn)在block元素的左邊、右邊(或兩者兼有)。)
?
12. A foated element must have a specifc width set to a value other than auto.?(浮動(dòng)元素必須指定寬度。)
?
13.If an absolutely positioned element is nested within another positioned element, then its position is relative to the containing element that is positioned.(如果一個(gè)設(shè)置了position屬性的元素嵌套在另一個(gè)設(shè)置了position屬性的元素內(nèi),則它的position是相對(duì)于包含著它的元素的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的元素仍然在流中,只是在元素顯示前,瀏覽器移動(dòng)了它的位置)
轉(zhuǎn)載于:https://www.cnblogs.com/StephenHuang/archive/2010/11/12/1875541.html
總結(jié)
以上是生活随笔為你收集整理的head first html with css with xhtml 学习小笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 数据结构——队列(C语言实现)
- 下一篇: C++ 并行与分布式编程 chapter