html標籤(二)

上一節,咱們講了,html標籤的head部分,此次咱們講講body部分,由於是介紹性質的,因此大體瞭解下就行了,知道這個標籤幹嗎用的 javascript

看例子 php

01 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
02 <html xmlns="http://www.w3.org/1999/xhtml">
03   <head>
04     <title>趴在樹上的豬</title>
05     <base href="http://news.baidu.com/resource/img/">
06     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
07     <link rel="stylesheet" type="text/css" href="/index.css" />
08     <script type="text/javascript">
09       document.write("Hello World!")
10     </script>
12     <style type="text/css">
13       body{color:#333;}
14     </style>
15   </head>
16   <body class="html">
17     <h1 onclick="javascript:alert('我是h1你點擊了我');">我是標題 1</h1>
18     <h2>我是標題 2</h2>
19     <h3>我是標題 3</h3>
20     <h4>我是標題 4</h4>
21     <h5>我是標題 5</h5>
22     <h6>我是標題 6</h6>
23     <p>我是P標籤</p>
24  
25     我要被<br />換行了
26     下面要輸出一條水平線
27     <hr />
28  
29     <!-- 我是註釋,我不會頁面上顯示 -->
30  
31     <div>
32     base的實例
33     <img src="logo_news_137_46.png">
34     </div>
35  
36     <h3></h3>
37     <a href="http://www.qaforcode.net">豬哥每日一貼</a>
38  
39     字體相關的標籤
40  
41     <div style="border:1px solid red">
42     <b>趴在樹上的豬 b</b>
43     <strong>趴在樹上的豬 strong</strong>
44     <i>趴在樹上的豬 i</i>
45     <em>趴在樹上的豬 em</em>
46     <big>趴在樹上的豬 big</big>
47     <small>趴在樹上的豬 small</small>
48     <sup>趴在樹上的豬 sup</sup>
49     <sub>趴在樹上的豬 sub</sub>
50     </div>
51  
52     其餘不經常使用標籤展現
53 <div style="border:1px solid green;">
54 <pre>pre 定義與格式文本</pre>
55  
56 <code>code 定義計算機代碼文本</code>
57  
58 <tt>tt 定義打字機文本</tt>
59  
60 <kbd> kbd 定義鍵盤文本</kbd>
61  
62 <var>var 定義變量部分 </var>
63  
64 <dfn>dfn 定義定義項目</dfn>
65  
66 <samp>samp 計算機代碼樣本</samp>
67  
68 <acronym>acronym 定義知趣首字母的縮寫</acronym>
69  
70 <abbr>abbr 定義縮寫</abbr>
71  
72 <address>address 定義文檔做者或者擁有者聯繫信息</address>
73  
74 <blockquote>blockquote 定義塊引用</blockquote>
75  
76 <q>q 定義短引用</q>
77  
78 <cite>cite 定義引用</cite>
79  
80 <ins>ins 插入文本</ins>
81  
82 <del>del 定義刪除文本</del>
83 </div>
84  
85     <div id="wrapper">
86     </div>
87   </body>
88 </html>

1、<body>標籤

head之外的標籤均可以出如今body裏。 css

標準屬性:id, class, title, style, dir, lang, xml:lang html

事件屬性:onload, onunload, onclick, ondblclick, onmousedown, onmouseup, onmouseover, java

onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

2、標題標籤

h1-h6能夠理解爲這一段的標題,也是個seo友好的標籤
有個align的可選屬性,但不推薦使用
標準屬性有id, class, title, style, dir, lang, xml:lang

事件屬性:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup jquery

好比點擊一下h1試試 ajax

3、<p>標籤

p標籤其實和div標籤其實差很少。 api

標準屬性:id, class, title, style, dir, lang, xml:lang app

事件屬性:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup 字體

4、換行標籤

<br>用來插入空行他沒有結束標籤,在xhtml中寫成<br />

標準屬性:id, class, title, style

5、水平線標籤

<hr>和<br>同樣沒有結束標籤,在xhtml中寫成<hr />

標準屬性:id, class, title, style, dir, lang, xml:lang

事件屬性:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

6、註釋

html的註釋和php中/**/有點象,只是把/*換成了<!– 把*/換成了–>註釋沒有屬性

7、字體樣式標籤

字體樣式標籤用法都是同樣的,全部瞭解下功能就能夠了,上例中的例子已經十分清晰了,你們的標準屬性都有:id, class, title, style, dir, lang, xml:lang

事件屬性都有:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

b 定義粗體

i 定義斜體

em 定義強調文本

big 定義大號字體

small 定義小號文本

strong 定義更爲強烈的強調文本

sup 上表

sub 下標

8、鏈接

<a>標籤即一個規定一段文字能鏈接到其餘頁面,這個標籤幾乎無處不在,隨便打開一個頁面都能看見。

標準屬性:id, class, title, style, dir, lang, xml:lang, tabindex, accesskey

事件屬性:onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

9、其餘不經常使用標籤

能夠說基本上用不到了解下便可

pre 定義與格式文本

code 定義計算機代碼文本

tt 定義打字機文本

kbd 定義鍵盤文本

var 定義變量部分

dfn 定義定義項目

samp 計算機代碼樣本

acronym 定義知趣首字母的縮寫

abbr 定義縮寫

address 定義文檔做者或者擁有者聯繫信息

blockquote 定義塊引用

q 定義短引用

cite 定義引用

ins 插入文本

del 定義刪除文本

object 插入對象,好比flash等

 

 

 

 

本文固定連接: http://www.qaforcode.net/archives/286 | 豬哥每日一貼

相關文章
相關標籤/搜索