input中给他赋值值完全隐藏不要圆点也不要星号不显示 但input本身框在只读框要在
要实现这个效果,你可以使用以下的HTML和CSS代码:
<!DOCTYPE html>
<html>
<head>
<style>
.input-box {
display: inline-block;
position: relative;
}
.input-box input {
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.input-box input[type="password"] {
-webkit-text-security: disc;
-moz-text-security: disc;
text-security: disc;
}
.input-box input[type="password"]::-webkit-input-placeholder {
color: transparent;
}
.input-box input[type="password"]:-moz-placeholder {
color: transparent;
}
.input-box input[type="password"]::-moz-placeholder {
color: transparent;
}
.input-box input[type="password"]:-ms-input-placeholder {
color: transparent;
}
.input-box input[readonly] {
background-color: #f2f2f2;
cursor: not-allowed;
}
</style>
</head>
<body>
<div class="input-box">
<input type="password" value="********" readonly>
</div>
</body>
</html>
这个代码会创建一个只读的密码输入框,密码会被隐藏,但输入框依然可见。
原文地址: https://www.cveoy.top/t/topic/jcfI 著作权归作者所有。请勿转载和采集!