I have the following HTML:
<input type="radio" name="beds" value="1" />1+ <input type="radio" name="beds" value="2" />2+
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.
The margin-right: 25px creates the space because the input tag is a radio, the text doesn't count into it. So it is just the little rond and if you write in your CSS to put a space at the right of it, it will put the space between the text and the rond input element.
You can add more space between a button and text box by using “margin” attribute. If you want to add right side more space then add “margin- right”, for left side “magin-left”, for top side “margin-top”, for bottom “margin-bottom”.
Just change the input id's width to auto in css.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With