.content{
width: 1500px;
height: 800px;
margin: 0px;
background: #FF99CC;
}
.content h1{
font-size: 50px;
padding-top: 200px;
text-align: center;
color: aquamarine;
}
.content form{
margin: fill;
padding: 1px;
}
.content form input{
margin-left: 600px;
border:1px ;
width:300px;
height:36px;
display:block;
border-radius:30px;
text-align:center;
margin-top:50px;
font-size:24px;
}
.one{
margin-left: 500px;
}
.content form button{
background:#FC3;
width:100px;
height:36px;
margin-top:50px;
margin-left:100px;
border-radius:30px;
}
.content form input:hover{
background:#F99;
}
首先先定義一個大的主容器content的樣式,然後在定義下面的元素,首先,在content下面定義了一個form,再在form下面定義其他的input樣式以及button樣式,因爲輸入賬號密碼框是上下相對的,我直接採用默認在div下面直接寫,而兩個button按鈕是一個在左一個在右的,所以我採用了表格的樣式,把他們兩個設置在了同一行,兩個button距離100px,此時,第一個button會離邊框也是100px,所以我又定義了一個塊級元素div,它的樣式是one,離邊框500px。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登錄頁面</title>
<link rel="stylesheet" href="register.css"/>
</head>
<body>
<div class="content">
<h1>Welcome to use the library</h1>
<hr/>
<form>
<div >
<input type="text" placeholder="請輸入賬號" name=" "/>
<input type="text" placeholder="請輸入密碼" name=" "/>
</div>
<div class="one">
<table>
<tr>
<td><button type="submit" >登錄</button> </td>
<td><button type="submit" >註冊</button> </td>
</tr>
</table>
</div>
</form>
<script>
function signIn(){
console.log("登錄");
}
function register() {
console.log("註冊");
}
</script>
</div>
</body>
</html>