当我重置密码输入上 ::placeholder 的样式时,它会在 Chrome 和 Chrome 上变成点。 Safari 浏览器

发布于 2025-01-10 22:34:09 字数 637 浏览 2 评论 0原文

我在 上使用 all: unset ,占位符变成了点。

HTML:

<input type="password" placeholder="text of placeholder">

CSS:

::placeholder {
    all: unset;
}

占位符的错误视觉结果:

占位符显示为项目符号

有没有办法仍然使用 all: unset 并带回正确显示的占位符的值?

CodePen 示例

I'm using all: unset on <input type="password" placeholder="text of placeholder"> and the placeholder turn into dots.

HTML:

<input type="password" placeholder="text of placeholder">

CSS:

::placeholder {
    all: unset;
}

The wrong, visual result of placeholder:

Placeholder shown as bullets

Is there any way to still use the all: unset and bring back the value of placeholder that will show up correctly?

CodePen Example

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城仅有旧梦在 2025-01-17 22:34:09

尝试-webkit-text-security:initial;https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-security

.reset-input::placeholder {
  all: unset;
  -webkit-text-security: initial;
}
<label>Reset Input</label>
<input class="reset-input" type="password" placeholder="placeholder text">

<br><br>

<label>UnReset Input</label>
<input type="password" placeholder="placeholder text">

try -webkit-text-security: initial; (https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-security)

.reset-input::placeholder {
  all: unset;
  -webkit-text-security: initial;
}
<label>Reset Input</label>
<input class="reset-input" type="password" placeholder="placeholder text">

<br><br>

<label>UnReset Input</label>
<input type="password" placeholder="placeholder text">

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文