標籤:html
HTML簡介
HTML是英文Hyper Text Mark-up Language(超文字標記語言 (HTML))的縮寫,他是一種製作全球資訊網頁面標準語言(標記)。相當於定義統一的一套規則,大家都來遵守他,這樣就可以讓瀏覽器根據標記語言的規則去解釋它。瀏覽器負責將標籤翻譯成使用者“看得懂”的格式,呈現給使用者!(例:djangomoan模版引擎)
650) this.width=650;" src="/e/u261/themes/default/images/spacer.gif" style="background:url("/e/u261/lang/zh-cn/images/localimage.png") no-repeat center;border:1px solid #ddd;" alt="spacer.gif" />650) this.width=650;" src="http://s2.51cto.com/wyfs02/M00/89/D4/wKiom1gewmHiXH32AABD7DhPvEs336.jpg" title="1.JPG" alt="wKiom1gewmHiXH32AABD7DhPvEs336.jpg" />
HTML文檔
Doctype
<!DOCTYPE html> /* 推薦 */Doctype告訴瀏覽器使用什麼樣的html或xhtml規範來解析html文檔
Meta(metadata information)
提供有關頁面的元資訊,例:頁面編碼、重新整理、跳轉、針對搜尋引擎和更新頻度的描述和關鍵詞
-
頁面編碼(告訴瀏覽器是什麼編碼)<meta http-equiv="content-type" content="text/html;charset=utf-8"><meta charset="UTF-8">
-
重新整理和跳轉<meta http-equiv="Refresh" Content="30"><meta http-equiv="Refresh" Content="5;Url= /* 這句話很厲害的 */
-
關鍵詞<meta name="keywords" content="星際2,星際老男孩,專訪,F91,小色,JOY" >
-
描述例如:cnblogs
-
X-UA-Compatible相容IE8以下貌似<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /><meta http-equiv="X-UA-Compatible" content="IE=edge" />
Title
網頁頭部資訊<title>it‘s title</title>
Link
-
css<link rel="stylesheet" type="text/css" href="css/common.css" >
-
icon<link rel="shortcut icon" href="image/favicon.ico">
Style
在頁面中寫樣式
<style type="text/css"> .bb{ background-color: red; } </style>Script
-
引進檔案<script type="text/javascript" src="http://xxx/js/gpt.js"></script >
-
寫js代碼<script type="text/javascript" > ... </script>
常用標籤
標籤一般分為兩種:塊級標籤 和 內聯(行內)標籤
-
a、span、select 等
-
div、h1、p 等
各種符號
http://www.cnblogs.com/web-d/archive/2010/04/16/1713298.html
p 和 br
p表示段落,預設段落之間是有間隔的!
br 是換行
a標籤
1、target屬性,_black表示在新的頁面開啟<a href="http://www.baidu.com" target="_blank" >new page</a>
2、錨<a href="#t31">各種符號</a> /* 通過id來尋找 */
H 標籤
<h1></h1> --> <h6></h6>
select 標籤
下拉式功能表<select><option>下線</option><option>線上</option></select>
radio
選項按鈕(name一致,便為一組,只能選擇一個選項)<input type="radio" name="gender" value="man"><input type="radio" name="gender" value="male">
password及text
<input type="text"><input type="password">
button
<input type="button" value="button"><input type="submit" value="submit"><input type="reset" value="reset">
file
<div id="t310"> <h2>file</h2> <input type="file" value="file"></div>提交檔案時要在 form 表單裡加上: enctype=‘multipart/form-data‘ method=‘POST‘
textarea
<textarea style="width:500px;height:200px;"></textarea>
label
<label for="name2">姓名:<input id="name2" type="text"></label><label for="marriy2">婚否:<input id="marriy2" type="checkbox"></label>
fieldset
<fieldset> <legend>登入</legend> <p>使用者名稱:</p> <p>密碼:</p></fieldset>
form 表單
<form method="POST" action="http://www.baidu.com"> <input type="submit" value="submit"></form>
一些補充
塊級標籤和內聯標籤
塊級標籤:<p><h1><table><ol><ul><form><div>
內聯標籤:<a><input><img><sub><sup><textarea><span>
block(塊)元素的特點
① 總是在新行上開始;
② 高度,行高以及外邊距和內邊距都可控制;
③ 寬度預設是它的容器的100%,除非設定一個寬度。
④ 它可以容納內嵌元素和其他塊元素
inline元素的特點
① 和其他元素都在一行上;
② 高,行高及外邊距和內邊距不可改變;
③ 寬度就是它的文字或圖片的寬度,不可改變
④ 內嵌元素只能容納文本或者其他內嵌元素
對行內元素,需要注意如下
設定寬度width 無效。
設定高度height 無效,可以通過line-height來設定。
設定margin 只有左右margin有效,上下無效。
設定padding 只有左右padding有效,上下則無效。注意元素範圍是增大了,但是對元素周圍的內容是沒影響的。
額外知識點
1、border-collapse: collapse;如果可能,邊框會合并為一個單一的邊框。會忽略 border-spacing 和 empty-cells 屬性。
2、border-spacing: 5px; border-spacing 屬性設定相鄰儲存格的邊框間的距離(僅用於“邊框分離”模式)
3、caption 元素定義表格標題,caption 標籤必須緊隨 table 標籤之後
4、clear:both,在左右兩側均不允許浮動元素。
5、<input type="radio" name="gender" value="male" checked> Male checked會預設選上
6、<option value="fiat" selected>Fiat</option> selected預設被選上的
Web開發(初級)- HTML基礎