CSS使文本字段看起来像密码字段

Dav*_*ito 3 html css

如何为texthtml 类型的输入字段设置CSS 以显示为密码字段,即输入中的文本似乎被诸如星号(“ *”)或点(“•” )?

我有这个约束:

<input name="passwordish" type="text" id="inputPassword" placeholder="Password" >

Run Code Online (Sandbox Code Playgroud)

编辑:很抱歉,如果不清楚,但是由于某些雪花飘落的原因,我无法更改字段类型!

Dea*_*nen 5

建议您将文本类型更改为密码

<input name="password" type="password" id="inputPassword" placeholder="Password" >

或这个

CSS技巧

input { -webkit-text-security: none; }
input { -webkit-text-security: circle; }
input { -webkit-text-security: square; }
input { -webkit-text-security: disc; /* Default */ }
Run Code Online (Sandbox Code Playgroud)

更新:

Mozilla / FireFox Explination

尝试这个:

input { -webkit-text-security: none; }
input { -webkit-text-security: circle; }
input { -webkit-text-security: square; }
input { -webkit-text-security: disc; /* Default */ }
Run Code Online (Sandbox Code Playgroud)

更新:

  • Firefox不再支持以下CSS:

    • -webkit-text-security

    • -moz-text-security

在Firefox 69.0,Windows 10、64位,