效果图:
<!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>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.father {
margin: 50px auto;
}
.pic {
/* 设置背景颜色、插入图片、图片不重复、图片居中 */
background: #ff5b00 url(use/mi-logo.png) no-repeat center center;
width: 50px;
height: 50px;
/* 图标边角的圆弧度 */
border-radius: 5%;
margin: auto;
}
.title {
margin-top: 20px;
/* 其内子元素是h1,我转化为行内块,方便居中 */
text-align: center;
}
h1 {
/* 字体不加粗 */
font-weight: 400;
/* 块元素转化为行内块 */
display: inline-block;
}
.uname,.pwd {
width: 330px;
height: 50px;
/* 重置边框的边框样式 */
border: 1px #e6e6e6 solid;
margin-top: 15px;
/* 设置内边距,使输入框内的字体距离左边框20px */
padding-left: 20px;
}
.input {
margin-top: 30px;
/* 其内三个都是表单元素,也就是行内元素,用text-align设置居中 */
text-align: center;
}
button {
width: 356px;
height: 50px;
background-color: #ff5b00;
color: white;
margin-top: 20px;
/* 按钮自带边框线,border:none去掉默认边框 */
border: none;
}
</style>
</head>
<body>
<div class="father">
<div class="pic"></div>
<div class="title">
<h1>小米账号登录</h1>
</div>
<div class="input">
<input type="text" placeholder="邮箱/手机号码/小米ID" class="uname"><br>
<input type="password" placeholder="密码" class="pwd"><br>
<button>登录</button>
</div>
</div>
</body>
</html>