Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Set Padding for All Sides At Once</title> <style> h1 { padding: 50px; /* apply to all four sides */ } p { padding: 25px 75px; /* vertical | horizontal */ } div { padding: 25px 50px 75px; /* top | horizontal | bottom */ } pre { padding: 25px 50px 75px 100px; /* top | right | bottom | left */ } h1, p, div, pre { background: lime; } </style> </head> <body> <h1>This is a heading</h1> <p>This is a simple paragraph of text.</p> <div>This is a DIV element.</div> <pre>This is a piece of preformatted text.</pre> <p><strong>Note:</strong> Play with the padding property value to see how it works.</p> </body> </html>