使用HTML5和CSS實現(xiàn)簡單的登陸界面
時間:2023-09-08 15:06:01 | 來源:網(wǎng)站運營
時間:2023-09-08 15:06:01 來源:網(wǎng)站運營
使用HTML5和CSS實現(xiàn)簡單的登陸界面:HTML文件源碼
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/login.css">
</head>
<body background="1.png" text="0">
<div id = 'test'></div>
<style>
</style>
<div class="content">
<!-- 登錄面板 -->
<div class="panel">
<!-- 賬號和密碼組 -->
<div class="group">
<label>賬號</label>
<input placeholder="請輸入賬號">
</div>
<div class="group">
<label>密碼</label>
<input placeholder="請輸入密碼" type="password">
</div>
<div class="login">
<button>獲取驗證嗎</button>
</div>
<div class="group">
<label>驗證碼</label>
<input placeholder="請輸入驗證碼" type="password">
</div>
<!-- 登錄按鈕 -->
<div class="login">
<button>登錄</button>
</div>
</div>
<!-- 注冊按鈕 -->
<!-- <div class="register">
// <button>創(chuàng)建新賬號</button>
// </div>
-->
</div></body>
</html>
CSS源碼:
/*按照樣圖要求,添加一個淺灰色背景*/
body{
background: url('../images/1.png') no-repeat;
background-size:100%;
}
/*設(shè)置內(nèi)容模塊距離頂部一個有一段距離150px*/
.content {
margin-top: 150px;
}
/*登錄和注冊按鈕的整體樣式*/
.content button {
height: 30px;/*登錄和注冊按鈕的高度*/
color: white;/*登錄和注冊按鈕字體顏色為白色*/
font-size: 18px;/*登錄和注冊按鈕的字體大小*/
border: 0px;/*無邊框*/
padding: 0px;/*無內(nèi)邊距*/
cursor: pointer;/*登錄和注冊按鈕的選擇時為手形狀*/
}
/*登錄面板*/
.content .panel {
background-color: white;/*登錄面板背景顏色為白色*/
width: 302px;/*寬度為302px*/
text-align: center;/*子內(nèi)容居中*/
margin: 0px auto;/*自身居中*/
padding-top: 20px;/*頂部的內(nèi)邊距為20px*/
padding-bottom: 20px;/*底部的內(nèi)邊距為20px*/
border: 1px solid #ddd;/*邊框顏色為灰色*/
border-radius: 5px;/*邊框邊角有5px的弧度*/
}
/*登錄和密碼組*/
.content .panel .group {
text-align: left;/*子內(nèi)容居中*/
width: 262px;/*寬度為262px*/
margin: 0px auto 20px;/*自身居中,并距離底部有20px的間距*/
}
.content .panel .group label {
line-height: 30px;/*高度為30px*/
font-size: 18px;/*字體大小為18px*/
}
.content .panel .group input {
display: block;/*設(shè)置為塊,是為了讓輸入框獨占一行*/
width: 250px;/*寬度為250px*/
height: 30px;/*高度為30px*/
border: 1px solid #ddd;/*輸入框的邊框*/
padding: 0px 0px 0px 10px;/*左邊內(nèi)邊距為10px,顯得美觀*/
font-size: 16px;/*字體大小*/
}
.content .panel .group input:focus{
border-left: 1px solid #CC865E;/*當(dāng)輸入框成為焦點時,左邊框顏色編程褐色*/
}
.content .panel .login button {
background-color: #CC865E;/*按鈕的背景顏色*/
width: 260px;/*按鈕的寬度*/
}
.content .panel .login button:hover {
background-color: white;/*按鈕選中后背景顏色為白色*/
color: #CC865E;/*按鈕選中后字體顏色為褐色*/
border: 1px solid #CC865E;/*按鈕選中后邊框顏色為褐色*/
}
/*注冊按鈕*/
.content .register {
text-align: center;/*子內(nèi)容居中*/
margin-top: 20px;/*頂部的內(nèi)邊距為20px*/
}
.content .register button {
background-color: #466BAF;/*按鈕的背景顏色為藍色*/
width: 180px;/*按鈕的寬度*/
}
.content .register button:hover {
background-color: white;/*按鈕選中后背景顏色為白色*/
color: #466BAF;/*按鈕選中后字體顏色為藍色*/
border: 1px solid #466BAF;/*按鈕選中后邊框顏色為藍色*/
}
設(shè)置圖片為本地圖片。
格式如下:大小自適應(yīng)
background: url('../images/1.png') no-repeat;
background-size:100%;
關(guān)鍵詞:登陸,界面,簡單,實現(xiàn),使用