What is the space between html elements that appears even when the margin and padding are set to 0, and how do I get rid of it?
Run the following code snippet and notice the space between the elements:
* {
margin:0;
padding:0;
}
.button-label, .tab-label {
display:inline-block;
background: #eee;
border: 1px solid;
}
[name="tab-group-1"] {
display: none;
}
Example 1:
<div class="button-container">
<button class="button-label">Button One</button>
<button class="button-label">Button Two</button>
<button class="button-label">Button Three</button>
</div>
Example 2:
<div class="radio-container">
<input type="radio" id="tab-1" name="tab-group-1" checked>
<label class="tab-label" for="tab-1">Tab One</label>
<input type="radio" id="tab-2" name="tab-group-1">
<label class="tab-label" for="tab-2">Tab Two</label>
<input type="radio" id="tab-3" name="tab-group-1">
<label class="tab-label" for="tab-3">Tab Three</label>
</div>