html如何定义包装块,尽管块中有空格,为什么在连续的块之间发生包装? - html代码 - 源码查...

问题

Say you want to create a form with labels for your input, and want to make it somehow responsive by displaying as many inputs along with their labels on each line. In order to do this, I thought about the automatic space wrapping : no space between labels and inputs, but space between each group.

AA

BB

CC

DD

EE

FF

As you can see, there is a space between each "group" of label+input due to the line break. But that does not seem to be OK for automatic wrapping as is seems wrapping is done between inputs and labels almost always. What I want is to wrap at the space, not between the label and the input!

What am I doing wrong ? Although I know wrapping each group in another item would work, I'd like to keep my code as light as possible. I tried some CSS, but did not manage to arrange this.

Thanks in advance for your help!

解决方法

Actually, this can be achieved by wrapping the input tags inside the labels and adding a CSS rule to labels :

label{

white-space:nowrap;

}

AA

BB

CC

DD

EE

FF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值