⊗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 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; }

:

Repeat the page according to this example:

Repeat the page according to this example:

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline