HTML入門知識點
1:基本編輯格式:
<html>
<head>
<meta charset="UTF-8">
<title>點擊這裏輸入標題</title>
</head>
<body>
</body>
</html>
:2:基本標籤:
標題:<h1>~<h6>(雙標籤)
<h1> 定義最大的標題。<h6> 定義最小的標題
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
段落:<p>(瀏覽器會自動地在段落的前後添加空行(<p> 是塊級元素))
<p>This is a paragraph</p>
<p>This is another paragraph</p>
鏈接:<a><a href="url">內容</a>
屬性:target:_blank 打開一個新窗口 _parent在原來的窗口中打開
如何鏈接到一個網頁的不同位置
1:同一個網頁中跳轉
目標位置:<a id="name"></a>
鏈接位置:<a href="#name"></a>
2:不同網頁之間的跳轉
目標網頁:<a id="name"></a>
鏈接網頁:<a href="文件地址#name"></a>
實現郵箱地址之間的跳轉
<a href=”mailto: 郵箱地址”></a>
**圖像:<img>**
` <img src="url"/>`
alt:替換文本屬性
路徑:
相對路徑:/ :表示根目錄
./ :表示當前目錄
../ : 表示上一級目錄(../../上二級)
絕對路徑:從盤符開始
**樣式標籤**
b 、strong 加粗
del 刪除線
i 、em 傾斜
sub 下標
sup 上標
pre 預格式化
small 小號字
big 大號字
hr 水平線
br 換行
註釋:<!--需要註釋的內容-->
** 表格 <table>**
<table>
<tr>
<th></th>(表格的表頭 居中加粗)
</tr>
<tr>
<td></td>
</tr>
</table>
*合併單元格*
1:跨列
<table>
<tr>
<td></td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
2:跨行
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td rowspan="2"></td>
</tr>
</table>
** 列表**
1:無序列表
<ul>
<li></li>
<li></li>
</ul>
2:有序列表
<ol>
<li></li>
<li></li>
<li></li>
</ol>
3:自定義
<dl>
<dt></dt>
<dd></dd>
<dt></dt>
<dd></dd>
</dl>
**表單**
<form></form>
type屬性:text: 定義常規文本輸入。
radio :定義單選按鈕輸入(選擇多個選擇之一)
checkbox:多選框
submit :定義提交按鈕(提交表單)
文本輸入:
<form>
<input type="text" name="" value="">
</form>
單選框:
<form>
<input type="radio" name="sex" value="male" checked>女
<input type="radio" name="sex" value="female">男
</form>
多選框:
<form>
<input type="checkbox" checked/>音樂
<input type="checkbox"/>旅遊
<input type="checkbox"/>看書
</form>
下拉表單:
<selsct name="">
<option value=""> </option>
<option value=""> <option>
<option value=""> <option>
</select>
多段文本域:
<textarea> 元素定義多行輸入字段(文本域)
<textarea name="" id="" cols="" rows="" style=""> 內容</textarea>
**按鈕**
<input type="submit"> 提交
<input type="reset"> 重置
<input type="button" value="不確定">
<button></button>
同意以上協議
<label for="agree">
<input type="checkbox" id="agree">
同意以上協議
</label>
**預定義選項列表**
<datalist> 元素爲 <input> 元素規定預定義選項列表。
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
用戶會在他們輸入數據時看到預定義選項的下拉列表。