Add margins with CSS

by danielkwood

HTML

<html>
    <head>
        <title>Margins</title>
        <link rel="stylesheet" href="theme.css" type="text/css"/>
    </head>
    <body>
        <h1>This is a heading</h1>
        <h2>This is smaller heading</h2>
        <p>And this is a paragraph</p>
        <img src="image.png" width="30%"/>
    </body>
</html>

CSS

body{
    font-family: Arial;
}
h1{
    background-color: orange;
    padding: 20px;
    border: 1px solid red;
    margin: 50px;
}
h2{
    background-color: yellow;
    padding: 20px;
    border: 1px solid black;
    margin-left: 20px;
    margin-right: 20px;
    margin-top: 10px;
    margin-bottom: 5px;
}
p{
    background-color: lightblue;
    padding: 20px;
    border: 1px solid black;
    margin: 10px 30px 10px 30px;
}
img{
    margin: 10%;
}