Reputation: 147
I am new to HTML, and would like to remove the space between the text which is in a h5 tag, and the select options
HTML
<h5>Text</h5>
<select style="width:180px">
<option value="0" selected="selected">Select option</option>
</select>
The above code has a fair sized gap in between the two elements. I'm not sure what css to use in order to remove the gap.
Upvotes: 0
Views: 2543
Reputation: 4912
You may use CSS in order to modify style for h5
tag, for example:
h5 {
margin: 0;
padding: 0;
}
The same goes for option
tag if you wish to modify that as well.
From here you can try if you like that result or would you like to modify h5 tag even further (remember, that you can even have negative margin values).
Upvotes: 1
Reputation: 6016
To remove any gaps you should set the margin
and padding
of both elements to 0
h5, select {
margin: 0;
padding: 0
}
Upvotes: 0
Reputation: 506
Edit: If you want to add space you need to wrap the select in a and then use the margin-top css property
If you want to remove the gap, use the margin-bottom or padding-bottom css property for the h5.
Edit 2: You might want to use classes instead of directly changing the styles of the base html tags, to prevent unwanted effect in other places of your page.
Upvotes: 0