主体结构是html+css+js结合使用, 这里会使用简单的事件方式来进行密码的显示和隐藏效果.
第一步:
先搭建html主体和css样式
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.box {
position: relative;
width: 400px;
border-bottom: 1px solid #ccc;
margin: 100px auto;
}
.box input {
width: 370px;
height: 30px;
outline: none;
border: 0;
}
.box img {
position: absolute;
top: 0;
right: 0;
width: 30px;
}
</style>
<body>
<div class=".box">
<input type="password"