When we need to create some space between two elements that have position: relative
and display: block
- a common way is to use margin
(or padding
).
In a vertical context, a common situation is label
and input
:
<div>
<label>First name</label>
<div class='input-wrapper'>
<input />
</div>
</div>
Let's say we need 15px
of vertical spacing - is there any convention which element should be responsible for the spacing here - ther upper element (label
) or the wrapping input div
?
The same question could probably be asked for horizontally positioned elements that need space between them.
I know that asking for conventions probably is against the rules at SO, but I'd really like to adhere to a pattern if there is any "industry standard".
Aucun commentaire:
Enregistrer un commentaire