Working with padding in CSS
We've covered the margin property, which makes an outward margin from the border. There's also a very similar property, padding, which makes an inward margin from the border.
Let's now look at examples of how this property works. First, I'll give a block without indents (its text is stuck to the borders):
<div id="elem">
some long text
</div>
#elem {
width: 300px;
border: 1px solid red;
text-align: justify;
}
:
Now let's set padding to 30px for all sides:
<div id="elem">
some long text
</div>
#elem {
padding: 30px;
width: 300px;
border: 1px solid red;
text-align: justify;
}
: