input输入框内设置placeholder的样式

本文探讨了默认input样式的设置方法,包括高度、宽度、字体大小和对齐方式,并详细介绍了针对不同浏览器(如谷歌内核、火狐、IE)的占位符样式调整,以确保一致的用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

默认input的样式

input{
	height: 40px;
	width: 300px;
	line-height: 40px;
	font-size: 20px;
	text-align: center;
}
<input type="text" placeholder="请输入你的账号">

存在兼容性问题

input::-webkit-input-placeholder{  // 针对 谷歌 内核
   font-weight:600;
    color:#f00;
    line-height:40px;
}
input:-moz-placeholder{   // 火狐
    font-weight:600;
    color:#f00;
    color:#f00;
}
input:-ms-input-placeholder{  // 微软ie
    font-weight:600;
    color:#f00;
    color:#f00;
}

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yunchong_zhao

帮到你了,请作者喝杯矿泉水可好

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值