我在單選按鈕之間有大約30px的垂直空間。設置爲margin-top
和margin-bottom
至0px
沒有效果。我怎樣才能消除垂直空間?如何擺脫單選按鈕的垂直邊距?
body {
margin: 2em;
font-family: Arial, Helvetica, sans-serif;
}
input[type="radio"] {
opacity: 0;
}
input[type="radio"]+label {
cursor: pointer;
border: 1px solid #ccc;
background: #efefef;
color: #aaa;
border-radius: 3px;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0);
display: block;
width: 200px;
height: 40px;
padding-left: 20px;
margin-top: 0px;
margin-bottom: 0px;
}
input[type="radio"]:checked+label {
background: #777;
border: 1px solid #444;
text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
color: white;
margin-top: 0px;
margin-bottom: 0px;
}
<input id="Radio1" name="Radios" type="radio">
<label for="Radio1">I am option1</label>
<input id="Radio2" name="Radios" type="radio" value="Option 2">
<label for="Radio2">I am option2</label>
<input id="Radio3" name="Radios" type="radio" value="Option 3">
<label for="Radio3">I am option3</label>