html input border-width,html - Setting border-top-width: 0px; on Input changes whole border appearan...

博主在尝试用CSS使两个输入框紧密排列,消除它们之间的间距和顶部边框,但发现当设置`border-top-width: 0px;`时,输入框的外观变为浅灰色,尺寸似乎也变大了。此问题在所有浏览器中都出现。解决方案可能涉及到输入框边框的样式重置和浏览器默认样式的覆盖。

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

I want to display two input fields under each other with no margin, no padding and no double border (so it pretty much looks like a regular table, with a single separation

line between each field).

Removing the margin was easy (margin-top: 0px; margin-bottom: 0px;), but when I tried to remove the top border with border-top-width: 0px;, the whole appearance of the input border changed to a lighter grey and the size looks larger too. This effect happens in all browsers.

Here is an example:

HTML

CSS:

input {

margin-top: 0px;

margin-bottom: 0px;

}

.test input {

border-top-width: 0px;

}

.test input:first-child {

border-top-width: 2px;

}

Image explaining what I want:

qULk0.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值