當採用flex佈局的時候,設置水平和垂直居中很容易。
沒有設置的時候
當我們設置如下代碼後
.web-login-content .content-wrapper .login-wrapper .content .content-form .password-wrapper .icon-password,
.web-login-content .content-wrapper .login-wrapper .content .content-form .username-wrapper .icon-username {
/* margin-top: 10px; */
flex: 40px 0 0;
width: 38px;
height: 38px;
display: flex;
/* 水平和垂直居中 */
justify-content: center;
align-items: center;
border: 1px solid rgba(7, 17, 27, 0.5);
font-size: 24px;
}