HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ border: 1px solid #8c8c8c; } div:nth-child(3){ margin: 50px; } div:nth-child(5){ margin: 50px 25px; } div:nth-child(7){ margin: 50px 25px 10px; } div:nth-child(9){ margin: 50px 25px 10px 5px; } </style> </head> <body> <h1>CSS margin Property</h1> <h2>margin: 50px;</h2> <div>all four margins are 50px.</div> <h2>margin: 50px 25px;</h2> <div>top and bottom margins are 50px, right and left margins are 25px.</div> <h2>margin: 50px 25px 10px;</h2> <div>top margin is 50px, right and left margins are 25px, bottom margin is 10px.</div> <h2>margin: 50px 25px 10px 5px;</h2> <div>top margin is 50px, right margin is 25px, bottom margin is 10px, left margin is 5px.</div> </body> </html>
OUTPUT
×

Save as Private