
批改狀態(tài):合格
老師批語:
制作一個(gè)用戶注冊表單,將課堂上提到的表單控件全部用到;
理解css模塊的思想,并試寫一個(gè)案例(選做)
實(shí)例演示基本選擇器與上下文選擇器
預(yù)習(xí)偽類選擇器與常用元素的css樣式設(shè)置,盒模型知識等
<!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>用戶注冊表</title>
</head>
<style>
div {
padding: 10px;
}
</style>
<body>
<h1>新用戶注冊登記表</h1>
<form action="" method="post">
<fieldset>
<legend>1.用戶賬號信息(必填):</legend>
<!-- 單行文本框 -->
<div>
<label for="username">注冊賬號:</label>
<input
type="text"
id="username"
autofocus
required
placeholder="必須是6-8位數(shù)"
maxlength="8"
/>
</div>
<!-- 密碼框 -->
<div>
<label for="password">用戶密碼:</label>
<input
type="password"
id="password"
required
placeholder="必須是字母+數(shù)字的組合"
/>
</div>
</fieldset>
<fieldset>
<legend>2.其他個(gè)人信息</legend>
<!-- 單選框 -->
<div>
<label for="">性別:</label>
<input type="radio" name="gender" value="male" id="male" />
<label>男</label>
<input type="radio" name="gender" value="female" id="female" />
<label>女</label>
<input
type="radio"
name="gender"
value="secret"
id="secret"
checked
/>
<label>保密</label>
</div>
<!-- 多選框 -->
<div>
<label for="">愛好:</label>
<!-- 因?yàn)樵试S同時(shí)提交多個(gè)值,所以name屬性要寫成數(shù)組格式 -->
<input type="checkbox" name="hobby[]" id="meishi" /><label
for="meishi"
>美食</label
>
<input type="checkbox" name="hobby[]" id="lvyou" /><label for="lvyou"
>旅游</label
>
<input type="checkbox" name="hobby[]" id="shuma" /><label for="shuma"
>數(shù)碼</label
>
<input type="checkbox" name="hobby[]" id="biancheng" checked /><label
for="biancheng"
>編程</label
>
</div>
<!-- 下拉列表 -->
<div>
<label for="">目前的會(huì)員身份</label>
<select name="level" id="">
<option value="1" selected>不是會(huì)員</option>
<option value="2">初級會(huì)員</option>
<option value="3">中級會(huì)員</option>
<option value="4">高級會(huì)員</option>
</select>
</div>
<!-- 多行文本框 - 文本域 -->
<div>
<label for="jieshao">自我介紹:</label>
<textarea
name="jieshao"
id="jieshao"
cols="22"
rows="5"
placeholder="介紹一下你自己的經(jīng)歷"
></textarea>
</div>
</fieldset>
<fieldset>
<legend>3.附件上傳</legend>
<!-- 文件上傳 -->
<div>
<label for="">照片上傳:</label>
<input type="file" name="userimg" />
<input type="submit" value="點(diǎn)擊上傳圖片" />
</div>
</fieldset>
<fieldset>
<legend>4.其他補(bǔ)充信息</legend>
<!-- 日期選擇控件 -->
<div>
<label for="">生日日期:</label>
<input type="date" name="depart" />
</div>
<!-- 電子郵箱 -->
<div>
<label for="email">郵箱地址:</label>
<input
type="email"
name="email"
id="email"
placeholder="demo@xxx.com"
/>
</div>
<!-- datalist 搜索框 自定義輸入+預(yù)選 -->
<div>
<label for="">邀請人:</label>
<input type="search" name="search" list="my-key" />
<datalist id="my-key">
<option value="張三"></option>
<option value="李四"></option>
<option value="王五"></option>
</datalist>
</div>
</fieldset>
<div>
<input type="submit" name="touxiang" value="點(diǎn)擊提交表單" />
</div>
</form>
</body>
</html>
CSS模塊化是為了使開發(fā)者更好的維護(hù)代碼,同時(shí)根據(jù)實(shí)際的需求按需加載,減少負(fù)荷、提高效率,可以實(shí)現(xiàn)分區(qū)獨(dú)立控制;
<!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= , initial-scale=1.0" />
<title>CSS模塊化開發(fā)</title>
<link rel="stylesheet" href="css/style.css" />
<!-- 另外一種引入方式 -->
<!-- <style>
@import url(css/style.css);
</style> -->
</head>
<body>
<!-- 頁頭 -->
<header>
<!-- 導(dǎo)航欄 -->
<nav>
<ul>
<li>首頁</li>
<li>博客</li>
<li>快訊</li>
<li>友鏈</li>
<li>關(guān)于</li>
</ul>
</nav>
</header>
<!-- 內(nèi)容 -->
<main>
<p>
php中文網(wǎng)提供大量免費(fèi)、原創(chuàng)、高清的php視頻教程,并定期舉行公益php培訓(xùn)!可邊學(xué)習(xí)邊在線修改示例代碼,查看執(zhí)行效果!php從入門到精通,一站式php自學(xué)平臺!
</p>
</main>
<!-- 頁腳 -->
<footer>
<ul>
<li>友情鏈接</li>
<li>關(guān)于我們</li>
<li>最新資訊</li>
</ul>
</footer>
</body>
</html>
CSS文件代碼4個(gè)
@import url(header.css);
@import url(main.css);
@import url(footer.css);
footer {
background: green;
}
<!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>
<div>
<p>標(biāo)簽選擇器</p>
</div>
</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>基本選擇器作業(yè)實(shí)例</title>
<style>
/* 標(biāo)簽選擇 */
p {
background: green;
}
/* 屬性選擇 */
li[id="1"] {
background: yellow;
}
</style>
</head>
<body>
<div>
<p class="content">標(biāo)簽選擇器</p>
<ul>
<li id="1">屬性選擇器</li>
<li>class選擇器</li>
<li>id選擇器</li>
</ul>
</div>
</body>
</html>
【類】樣式選擇 - “ class “
【id】樣式選擇 - “ id “
已預(yù)習(xí)
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號