
批改狀態(tài):合格
老師批語:
<!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>1221homework</title>
</head>
<body>
<!--1. 實例演示Ement常用語法
2. 實例演示元素四類屬性
3. 實例演示布局標簽,并分析div+class與 html5語義化標簽的優(yōu)缺點-->
<!-- 1.實例演示Ement常用語法 -->
<!-- 父子關系:> -->
<!--p>input.name{請輸入姓名}-->
<p><input type="text" class="name">請輸入姓名</input></p>
<!-- p>input#password{請輸入密碼} -->
<p><input type="password" id="password">請輸入密碼</input></p>
<!-- 兄弟關系:+ -->
<!-- p+button.commit{提交} -->
<p></p>
<button class="commit" onclick="alert('提交成功')">提交</button>
<!-- 向上一級:^ -->
<!-- div>img.img[src=http://img95.699pic.com/photo/50167/4554.jpg_wh300.jpg!/fh/300/quality/90]^p -->
<div><img src="http://img95.699pic.com/photo/50167/4554.jpg_wh300.jpg!/fh/300/quality/90" alt="" class="img"></div>
<p></p>
<!-- 重復:* -->
<!-- ul>li*5{demo$} -->
<ul>
<li>demo1</li>
<li>demo2</li>
<li>demo3</li>
<li>demo4</li>
<li>demo5</li>
</ul>
<!-- ul.goods>li.class$*3>a[]{商品$} -->
<ul class="goods">
<li class="class2"><a href="https://php.cn/">商品2</a></li>
<li class="class3"><a href="https://php.cn/">商品3</a></li>
<li class="class1"><a href="https://php.cn/">商品1</a></li>
</ul>
<br/>
<!-- ul.goods1>li.item$*5>a[]{課程$@1221} -->
<ul class="goods1">
<li class="item1"><a href="https://php.cn/">課程1221</a></li>
<li class="item2"><a href="https://php.cn/">課程1222</a></li>
<li class="item3"><a href="https://php.cn/">課程1223</a></li>
<li class="item4"><a href="https://php.cn/">課程1224</a></li>
<li class="item5"><a href="https://php.cn/">課程1225</a></li>
</ul>
<style>
.goods{
color:aquamarine;
background-color: rgb(196, 226, 167);
}
</style>
<!-- 畫一個3*5的表格 -->
<table border="1">
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
<tr>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
<td>AAA</td>
</tr>
</table>
<!-- 1.通用屬性 id,class,style -->
<div class="class">測試class屬性</div>
<div id="id">測試id屬性</div>
<div style="color: brown;">測試style屬性</div>
<!-- 2.預設屬性: href... -->
<a href="http://php.cn/">測試a標簽的預設屬性</a>
<img src="http://pic171.huitu.com/pic/20211027/774808_20211027220017955070_0.jpg" alt="" class="img">測試圖片的預設屬性</img>
<!-- 3.事件屬性:on事件(onclick等) -->
<button onclick="alert('提交成功')">提交</button>
<div>
<input type="text" oninput="this.nextElementSibling.textContent=this.value">
<p>實時顯示輸入內(nèi)容</p>
</div>
<!-- 4.自定義屬性 -->
<div data-email="my@163.com">用戶信息</div>
<button onclick="this.nextElementSibling.textContent=this.previousElementSibling.dataset.email">獲取用戶郵箱</button>
<p>這里顯示用戶郵箱</p>
<!--為什么大多數(shù)程序員更喜歡使用通用標簽?
1、現(xiàn)在大多數(shù)項目基于移動端,不依賴或不在乎搜索引擎
2、語義化標簽是有限的,而用class自定義字符串去描述的屬性更多樣,更自由一點。
3、語義化標簽并沒有被淘汰,可以混合使用。 -->
</body>
</html>
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號