如何更改单选按钮与其文本之间的间距? [英] How to change spacing between radio button and its text?
本文介绍了如何更改单选按钮与其文本之间的间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下HTML:
<input type="radio" name="beds" value="1" />1+
<input type="radio" name="beds" value="2" />2+
如何更改单选按钮和"1+"文本之间的间距?我希望文本与单选按钮更接近,但浏览器正在两个元素之间插入一定数量的未定义填充.
How do I change the spacing between the radio button and the "1+" text? I'd like the text to be closer to the radio button, but the browser is inserting a certain amount of undefined padding between the two elements.
推荐答案
许多HTML元素都有默认的边距设置.您可以覆盖它并将其设置为0.在您的情况下,您想在单选按钮上重置margin-right
:
Many HTML elements have a default margin setting. You can override this and set it to 0. In your case, you want to reset margin-right
on the radio button:
<input type="radio" name="beds" value="1" style="margin-right: 0" />1+
您可能希望将其添加到样式表中,以便将其应用于所有单选按钮:
You probably want to add it to your stylesheet so that it applies to all radio buttons:
input[type="radio"] {
margin-right: 0;
}
这篇关于如何更改单选按钮与其文本之间的间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文