【发布时间】:2023-02-15 16:01:31
【问题描述】:
我有一个带有占位符文本的 <input> 元素的 Mailchimp 注册表单。在 Chrome、Firefox 和 Microsoft Edge 上,它显示正常,但在 Safari(桌面和移动)上,占位符文本不显示。它是空白的。代码如下:
<input type="email" placeholder="Enter your email" onfocus="this.placeholder='Enter your email'" name="EMAIL" id="mce-EMAIL" class="required email" required="" aria-required="true">
我使用 web-kit 修复程序从自动完成中删除背景颜色,使用白色文本,并添加文本样式。
input:-webkit-autofill,
input:-webkit-autofill:active,
input:-webkit-autofill:focus,
input:-webkit-autofill:hover,
select:-webkit-autofill,
select:-webkit-autofill:active,
select:-webkit-autofill:focus,
select:-webkit-autofill:hover,
textarea:-webkit-autofill,
textarea:-webkit-autofill:active,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:hover {
background-color: #ED3A38 !important;
transition: background-color 5000s ease-in-out 0s !important;
-webkit-text-fill-color: #FFFFFF !important;
font-size: 6vw !important;
}
以及按照this 指南更改占位符文本颜色和大小:
input:-webkit-autofill::first-line,
input:-internal-autofill-previewed,
::-webkit-input-placeholder,
::-moz-placeholder,
:-ms-input-placeholder,
::-ms-input-placeholder,
:-moz-placeholder {
-webkit-text-fill-color: #FFFFFF !important;
font-size: 6vw !important;
letter-spacing: -0.057em;
}
::placeholder {
color: #FFFFFF !important;
opacity: 1 !important;
}
我坚持为什么这不起作用。有什么我想念的吗?
这是生产中的实例:link
【问题讨论】:
-
什么版本的 Safari/IOS?