html - 文本区域的占位符颜色
问题描述
我有一个如下所示的文本区域。
textarea::placeholder {
color: #999 !important;
}
textarea::-moz-placeholder {
color: #999 !important;
}
input[type='text']::placeholder, textarea::placeholder{
color:#999 !important;
}
<input type="text" placeholder="Check List" name="check_list" /><br/>
<textarea rows="4" cols="50" placeholder="Description" name="description"></textarea>
我得到如下输出
我为Check List
和Description
字段应用相同的颜色。但输出不一样。为什么输出不一样?
我的Check List
CSS 如下所示
input[type='text']::placeholder, textarea::placeholder{
color:#999 !important;
}
解决方案
您正在将样式应用于<textarea/>
元素,但清单元素是<input type='text'/>
. 您需要将 css 样式应用于input[type='text']
或任何您想要的选择器。
推荐阅读
- laravel - 如何使用 Laravel 在登录中添加 Spatie 角色条件
- linux - rpm.spec 隐藏 %post 之后的警告
- c# - 对包含浮点数的字符串列表进行排序
- keras - 如何将 CNN LSTM 形式的 keras 转换为 pytorch
- java - 手动旋转 3D 对象 - Android
- react-native - 如何在 react-native 抽屉导航中更改特定屏幕上的屏幕背景颜色?
- android - Flutter Ad Mob 在使用真实 App Id 时使我的 Android 应用崩溃
- c# - ASP .NET Identity Owin PasswordSignInAsync 方法有时不起作用
- ios - 关闭活动工作表的正确方法?
- sql-server - 使用连接的子查询提高更新性能