CodeLab
Tutorials For Everyone
Run
<!Doctype HTML> <html> <head> <title>CSS Margins for Individual Sides</title> <style> .para{ padding: 50px; background: #29b6f6; color: #fff; text-align: center; margin: 0px 100px 20px 50px; } </style> </head> <body> <h2>CSS Margins for Individual Sides</h2> We can set the margin of an element's individual sides as follows. <div style="border: 5px solid #555;"> <p class="para"> This paragraph element has margin values as <kbd>margin-left: 50px;</kbd>, <kbd>margin-top: 0px;</kbd>, <kbd>margin-right:100px;</kbd> and <kbd>margin-bottom: 20px;</kbd> </p> </div> </body> </html>