I want to apply some padding to the div, but when the padding property is applied, the size of the div increases because the padding size is added to the div.
<div id="someDiv">
someContent
</div>
#someDiv{
padding: 1em;
}
Is there any way to apply padding without increasing the size of the div? I have one solution that involves adding another with the contents of a div inside #someDiv and applying a field to it, but I don't know if this is the best solution.
Something like that:
<div id="someDiv">
<div idi="anotherDiv">
someContent
</div>
</div>
#anotherDiv{
margin: 1em;
}
source
share