⊗mkPmBMPd 132 of 250 menu

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 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 text... </div> #elem { padding: 30px; width: 300px; border: 1px solid red; text-align: justify; }

:

Repeat the page according to this example:

Repeat the page according to this example:

enru