1 基本
1.1 第一個(gè)前端程序
- 內(nèi)容
<html>
<head>
<title>我的網(wǎng)頁(yè)</title>
</head>
<body>
Hello,我的第一個(gè)網(wǎng)頁(yè)
</body>
</html>
使用瀏覽器打開(kāi)
1.2 工具安裝
- 瀏覽器
谷歌瀏覽器
清緩存
ctrl+shift+delete
- vscode
- 生成瀏覽器文件.html的快捷方式
!+回車(chē)
- 常用快捷鍵
- 快速打開(kāi)瀏覽器
插件open in browser 安裝,就會(huì)多出兩個(gè)選項(xiàng)來(lái)
2 Html5
2.1 介紹
- 概念
是一種用來(lái)描述網(wǎng)頁(yè)的一種語(yǔ)言,被稱(chēng)為超文本標(biāo)記語(yǔ)言,本質(zhì)是標(biāo)記語(yǔ)言,標(biāo)記語(yǔ)言是一套標(biāo)記標(biāo)簽,一般用
- DOCTYPE聲明
DOCTYPE是document type(文檔類(lèi)型)的縮寫(xiě)。
<!DOCTYPE html>
是H5的聲明位于文檔的最前面,甚至在<html>之前
作用是網(wǎng)頁(yè)必備的組成部分,避免瀏覽器的怪異模式
- html5的基本骨架
-
html標(biāo)簽
-
head標(biāo)簽
- 必須包含title標(biāo)簽
- meta標(biāo)簽:一般是限定utf-8編碼格式,注意是一個(gè)單標(biāo)簽
-
body標(biāo)簽
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
我的第一個(gè)網(wǎng)頁(yè)
</body>
</html>
2.2 標(biāo)簽之標(biāo)題
- 標(biāo)題介紹
從h1到h6從大到小,雙標(biāo)簽
<h1>一級(jí)標(biāo)簽</h1>
<h2>二級(jí)標(biāo)簽</h2>
<h3>三級(jí)標(biāo)簽</h3>
<h4>四級(jí)標(biāo)簽</h4>
<h5>五級(jí)標(biāo)簽</h5>
<h6>六級(jí)標(biāo)簽</h6>
- 案例
<!DOCTYPE html>
<html>
?
<head>
<meta charset="UTF-8">
?
<title>Document</title>
</head>
?
<body>
<h1>一級(jí)標(biāo)題</h1>
<h2>二級(jí)標(biāo)題</h2>
<h3>三級(jí)標(biāo)題</h3>
<h4>四級(jí)標(biāo)題</h4>
<h5>五級(jí)標(biāo)題</h5>
<h6>六級(jí)標(biāo)題</h6>
</body>
?
</html>
快捷鍵
h$*6+回車(chē)
- 網(wǎng)頁(yè)案例
https://www.mi.com/shop
- 標(biāo)題標(biāo)簽位置擺放
align="left center | right"
默認(rèn)為左的,可以設(shè)置屬性變成右邊
2.3 標(biāo)簽之段落、換行、水平線(xiàn)
- 概念
段落§:通過(guò)段落去承載文本
換行(br)
水平線(xiàn)(hr)
- 段落
- 運(yùn)用
<!DOCTYPE html>
<html lang="en">
?
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
?
<body>
<p>我是一個(gè)段落標(biāo)簽</p>
</body>
?
</html>
- 網(wǎng)頁(yè)案例
3. 換行
- 運(yùn)用
注意是單標(biāo)簽
<!DOCTYPE html>
<html lang="en">
?
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
?
<body>
<p>我是一個(gè)段落標(biāo)簽</p>
<p>如果您希望在不產(chǎn)生一個(gè)<br>新段落的情況下進(jìn)行換行</p>
</body>
?
</html>
- 水平線(xiàn)
- 運(yùn)用
- 案例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<p>我是一個(gè)段落標(biāo)簽</p>
<p>如果您希望在不產(chǎn)生一個(gè)<br>新段落的情況下進(jìn)行換行</p>
<hr color="red" width="300px" size ="10px" align = "left">
</body>
</html>
2.4 標(biāo)簽的圖片
- 概念
使用標(biāo)簽定義HTML頁(yè)面中的圖像
<img scr="" alt="" title="" width="" height="">
- 運(yùn)用
- 用法
- scr
圖片必須和代碼在同一個(gè)文件夾下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<img src="1683454588303.jpg" >
</body>
</html>
效果
- alt
<body>
<img src="1683454588303.jpg" alt = "我的qq頭像">
</body>
當(dāng)圖片獲取不到的時(shí)候,會(huì)顯示alt的名字,即代替文本
- width
<body>
<img src="1683454588303.jpg" alt = "我的qq頭像" width="300px">
</body>
- height
<body>
<img src="1683454588303.jpg" alt = "我的qq頭像" width="300px" height="300px">
</body>
- title
鼠標(biāo)邊邊會(huì)出現(xiàn)文字提示
- 關(guān)于scr的補(bǔ)充
- 絕對(duì)路徑
- 相對(duì)路徑
子級(jí)關(guān)系/
父級(jí)關(guān)系…/
同級(jí)關(guān)系./
2.5 超文本鏈接
- 概念
使用來(lái)設(shè)置超文本鏈接,其中href屬性來(lái)描述鏈接的地址
<a href="url">鏈接文本</a>
- 運(yùn)用
<body>
<a >百度</a>
</body>
記得寫(xiě)全https://
圖片也可以當(dāng)作跳轉(zhuǎn)的中介
<body>
<a >
<img src="1683454588303.jpg" alt="qq頭像" width="300px">
</a>
</body>
2.6 文本標(biāo)簽
- 基本使用
<body>
<em>月月</em>
<b>月月</b>
<i>月月</i>
<strong>月月</strong>
<del>月月</del>
<span>月月</span>
</body>
- 嵌套
<body>
<p>我喜歡吃<em>em白菜</em></p>
</body>
2.7 列表標(biāo)簽之有序列表
- 有序列表
- 基本使用
<body>
<ol>
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
<li>火龍果</li>
</ol>
</body>
- ol屬性
<body>
<ol type ="1">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
<li>火龍果</li>
</ol>
<ol type ="a">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
<li>火龍果</li>
</ol>
</body>
- 嵌套
也可以嵌套,li中再套一組ol
<body>
<ol>
<li>水果</li>
<li>
蔬菜
<ol>
<li>白菜</li>
<li>油菜</li>
</ol>
</li>
</ol>
</body>
2.8 無(wú)序列表
- 概念
<ul>
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
</ul>
</body>
- ul屬性
<body>
<ul type ="disc">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
</ul>
<ul type ="circle">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
</ul>
<ul type = "squre">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
</ul>
<ul type = "none">
<li>蘋(píng)果</li>
<li>橘子</li>
<li>香蕉</li>
</ul>
</body>
- 嵌套
也可以嵌套的
- 實(shí)際運(yùn)用
- 百度新聞
- 小米
輔助以css
- 快捷鍵
ul>li*2
2.9 標(biāo)簽之表格
- 概念
表格:
行:,有幾行就幾個(gè)tr
單元格(列):,有幾列就在tr中寫(xiě)幾列,中間可以寫(xiě)文本的
- 運(yùn)用
三行三列的單元格
<body>
<table>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</body>
- 快捷鍵
table <tr*2>td{單元格}
table>tr*3>td*3{哦哦}
回車(chē)成這樣
<table>
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
</table>
- 屬性
- 基本屬性
以后用css調(diào)整的多
- 運(yùn)用
<table border="1">
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
<tr>
<td>哦哦</td>
<td>哦哦</td>
<td>哦哦</td>
</tr>
</table>
- 效果
寬高也可以設(shè)置,也可以后css調(diào)整
- 單元格合并
- 水平合并colspan
<body>
<p>合并單元格</p>
<table border="1">
<tr>
<td>yes1</td>
<td>yes2</td>
<td>yes3</td>
</tr>
<tr>
<td colspan="2">yes4 yes5</td>
<td>yes6</td>
</tr>
<tr>
<td>yes7</td>
<td>yes8</td>
<td>yes9</td>
</tr>
</table>
</body>
- 垂直合并rowspan
<body>
<p>水平合并單元格3,4以及垂直合并單元格3,6</p>
<table border="1">
<tr>
<td>yes1</td>
<td>yes2</td>
<td rowspan="2">yes3 yes6</td>
</tr>
<tr>
<td colspan="2">yes4 yes5</td>
</tr>
<tr>
<td>yes7</td>
<td>yes8</td>
<td>yes9</td>
</tr>
</table>
</body>
效果
如果合并四個(gè),先水平合并,后垂直合并
2.10 表單
- 引入
- 屬性
表單一般包括容器和控件,控件包含輸入框和按鈕
<form action="url" method ="get|post" name="myform"></form>
action服務(wù)器地址,method請(qǐng)求類(lèi)型,name表單名字
- 組成
表單標(biāo)簽,表單域(輸入框),表單按鈕
<form>
<input type ="text">
<input type = "submit">
</form>
- 補(bǔ)充表單元素
- 文本框
<form>
用戶(hù)名:<input type ="text">
</form>
- 密碼框
<form>
Password:<input type ="password" name = "pwd">
</form>
密碼是小黑圓點(diǎn)文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-439726.html
- 提交按鈕
<form>
<input type = "submit" value = "Submit">
</form>
文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-439726.html
到了這里,關(guān)于前端-01Html5基本知識(shí)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!