新增語義化標(biāo)簽
新增布局標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<!-- 頭部 -->
<header>
<h1>尚品匯</h1>
</header>
<hr>
<!-- 主導(dǎo)航 -->
<nav>
<a href="#">首頁</a>
<a href="#">訂單</a>
<a href="#">購物車</a>
<a href="#">我的</a>
</nav>
<!-- 主要內(nèi)容 -->
<div class="page-content">
<!-- 側(cè)邊欄導(dǎo)航 -->
<aside style="float:right;">
<nav>
<ul>
<li><a href="#">秒殺專區(qū)</a></li>
<li><a href="#">會員專區(qū)</a></li>
<li><a href="#">品牌專區(qū)</a></li>
<li><a href="#">優(yōu)惠專區(qū)</a></li>
</ul>
</nav>
</aside>
<!-- 文章 -->
<article>
<h2>《如何一夜暴富》</h2>
<section>
<h3>第一種方式:白日夢</h3>
<p>你應(yīng)該......</p>
</section>
<section>
<h3>第二種方式:白日夢</h3>
<p>你應(yīng)該......</p>
</section>
<section>
<h3>第三種方式:白日夢</h3>
<p>你應(yīng)該......</p>
</section>
</article>
</div>
<hr>
<footer>
<nav>
<a href="#">友情鏈接</a>
<a href="#">友情鏈接</a>
<a href="#">友情鏈接</a>
<a href="#">友情鏈接</a>
</nav>
</footer>
</body>
</html>
新增狀態(tài)標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<style>
progress {
width: 50px;
}
</style>
</head>
<body>
<span>手機電量:</span>
<meter max="100" min="0" value="5" low="10" high="20" optimum="90"></meter>
<br>
<span>當(dāng)前進度:</span>
<progress max="100" value="80"></progress>
</body>
</html>
新增列表標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<form action="#">
<input type="text" list="mydata">
<button>搜索</button>
</form>
<datalist id="mydata">
<option value="周杰倫">周杰倫</option>
<option value="周冬雨">周冬雨</option>
<option value="馬冬梅">馬冬梅</option>
<option value="溫兆倫">溫兆倫</option>
</datalist>
<details>
<summary>如何一夜暴富?</summary>
<p>好好學(xué)習(xí),天天上線</p>
</details>
</body>
</html>
新增文本標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<ruby>
<span>魑魅魍魎</span>
<rt>chī mèi wǎng liǎng</rt>
</ruby>
<hr>
<ruby>
<span>魑</span>
<rt>chī</rt>
</ruby>
<hr>
<p>Lorem ipsum <mark>dolor</mark> sit amet consectetur adipisicing elit. Tenetur impedit quasi, minima ullam sequi quaerat veniam fugiat distinctio. Iure temporibus laborum earum tenetur suscipit odit ad excepturi ut eaque ab!</p>
</body>
</html>
表單相關(guān)新增
新增表單控件屬性
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<form action="">
賬號:<input type="text" name="account" placeholder="請輸入賬號" required autofocus autocomplete="on" pattern="\w{6}">
<br>
密碼:<input type="password" name="pwd" placeholder="請輸入密碼" required pattern="\w{6}">
<br>
性別:
<input type="radio" value="mail" name="gender" required>男
<input type="radio" value="femail" name="gender" required>女
<br>
愛好:
<input type="checkbox" value="book" name="hobby">讀書
<input type="checkbox" value="music" name="hobby" required>音樂
<input type="checkbox" value="movie" name="hobby">電影
<br>
其他:<textarea name="other" required></textarea>
<br>
<button>提交</button>
</form>
</body>
</html>
input新增type屬性值
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<form action="" novalidate>
<!-- 郵箱:<input type="email" name="email"> -->
<br>
<!-- url:<input type="url" requried name="url"> -->
<br>
<!-- 數(shù)值:<input type="number" name="number" step="2" max="80" min="20"> -->
<br>
<!-- 搜索:<input type="search" name="keyword"> -->
<br>
<!-- 電話:<input type="tel" name="phone"> -->
<br>
<!-- 范圍:<input type="range" name="range" max="80" min="20" value="22"> -->
<br>
<!-- 顏色:<input type="color" name="color"> -->
<br>
<!-- 日期:<input type="date" name="date"> -->
<br>
<!-- 月份:<input type="month" name="month"> -->
<br>
<!-- 周:<input type="week" name="week"> -->
<br>
<!-- 時間:<input type="time" name="time"> -->
<br>
<!-- 日期+時間:<input type="datetime-local" name="time2"> -->
<button>提交</button>
</form>
</body>
</html>
新增多媒體標(biāo)簽
新增視頻標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<style>
video {
width: 600px;
}
</style>
</head>
<body>
<video src="./資料/resource/小電影.mp4" controls muted loop poster="./資料/封面.png" preload="auto"></video>
</body>
</html>
新增音頻標(biāo)簽
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<style>
audio {
width: 600px;
border: 1px solid skyblue;
}
</style>
</head>
<body>
<audio src="./資料/小曲.mp3" controls muted loop preload="auto"></audio>
</body>
</html>
<!DOCTYPE html>
<html lang="zh-CN">
<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>
<style>
audio {
width: 600px;
}
.mask {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(0,0,0,0.727);
}
.dialog {
position: absolute;
width: 400px;
height: 400px;
background-color: green;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
font-size: 40px;
text-align: center;
line-height: 400px;
}
span {
border: 1px solid white;
color: white;
cursor: pointer;
}
</style>
</head>
<body>
<audio id="music" src="./資料/小曲.mp3" controls></audio>
<div class="mask" id="mask">
<div class="dialog">
<span>點我登陸</span>
<span onclick="go()">隨便聽聽</span>
</div>
</div>
<script>
function go(){
music.play()
mask.style.display = 'none'
}
</script>
</body>
</html>
新增全局屬性
文章來源:http://www.zghlxwxcb.cn/news/detail-532331.html
兼容性處理
文章來源地址http://www.zghlxwxcb.cn/news/detail-532331.html
到了這里,關(guān)于前端學(xué)習(xí)——HTML5的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!