
批改狀態(tài):合格
老師批語(yǔ):課上的內(nèi)容總結(jié)到位
<!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>模態(tài)框</title>
<style>
/* 頁(yè)面內(nèi)容初始化 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 10px;
}
body {
font-size: 1.6rem;
}
a {
text-decoration: none;
color: white;
}
/* 配置模態(tài)框 */
.modal {
position: relative;
display: none;
}
/* 配置遮罩 */
.modal .modal-bgc {
position: fixed;
background-color: rgb(0, 0, 0, 0.5);
top: 0;
right: 0;
bottom: 0;
left: 0;
}
/* 配置登錄表單,使用grid布局 */
.modal .modal-form {
/* 臨時(shí)加入一個(gè)顏色方便布局 */
/* background-color: lightskyblue; */
position: fixed;
left: 20rem;
right: 20rem;
top: 20rem;
}
.modal .modal-form fieldset {
background-color: lightskyblue;
border: none;
display: grid;
gap: 1rem;
padding: 3rem;
box-shadow: 0 0 5px #888;
}
.modal .modal-form fieldset legend {
padding: 1rem;
background-color: hotpink;
color: white;
}
.modal .modal-form fieldset div input {
width: 100%;
}
/* 頁(yè)眉使用flex布局 */
.header {
background-color: lightskyblue;
width: 100%;
height: 6rem;
display: flex;
font-size: 1.8rem;
place-content: space-between;
padding: 1rem;
}
/* 給頁(yè)眉的按鈕添加樣式 */
.header button {
width: 6rem;
font-size: 1.8rem;
}
/* 限制一下主體中測(cè)試圖片的寬度 */
.main img {
width: 100%;
}
/* 給頁(yè)腳添加一些樣式 */
.footer {
background-color: lightslategray;
width: 100%;
height: 10rem;
padding: 2rem 0 0 2rem;
}
.footer a:hover {
color: lightskyblue;
}
</style>
</head>
<body>
<!-- 配置模態(tài)框背景 -->
<!-- 配置登錄表單 -->
<!-- 將頁(yè)面分成三部分,頁(yè)眉,主體,頁(yè)腳 -->
<!-- 模態(tài)框 -->
<div class="modal">
<div class="modal-bgc" onclick="this.parentNode.style.display='none'"></div>
<form action="" class="modal-form">
<fieldset>
<legend>用戶(hù)登錄</legend>
<div class="uname">
<label for="uname">賬號(hào):</label>
<input type="text" name="uname" id="uname" placeholder="請(qǐng)輸入賬號(hào)或手機(jī)號(hào)" required />
</div>
<div class="pwd">
<label for="pwd">密碼:</label>
<input type="password" name="pwd" id="pwd" placeholder="請(qǐng)輸入密碼" required />
</div>
<button>登錄</button>
</fieldset>
</form>
</div>
<!-- 頁(yè)眉 -->
<div class="header">
<!-- 添加一個(gè)標(biāo)題跟按鈕-->
<h2>超超多喝水</h2>
<button onclick="document.querySelector('.modal').style.display='block'">登錄</button>
</div>
<!-- 主體 -->
<div class="main">
<img src=" 替換為圖片鏈接" alt="" />
<img src=" 替換為圖片鏈接" alt="" />
<img src=" 替換為圖片鏈接" alt="" />
<img src=" 替換為圖片鏈接" alt="" />
<img src=" 替換為圖片鏈接" alt="" />
<img src=" 替換為圖片鏈接" alt="" />
</div>
<!-- 頁(yè)腳 -->
<div class="footer">
<span>友情鏈接:</span>
<a href="http://ipnx.cn/">php中文網(wǎng)</a>
</div>
</body>
</html>
微信掃碼
關(guān)注PHP中文網(wǎng)服務(wù)號(hào)
QQ掃碼
加入技術(shù)交流群
Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)