Add borders with CSS
by danielkwood
HTML
<html>
<head>
<title>Borders</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-style: solid;
border-width: 2px;
border-color: black;
}
h2{
background-color: yellow;
padding: 20px;
border: 3px dashed blue;
}
p{
background-color: lightblue;
padding: 20px;
border-top: 3px dotted red;
border-left: 3px dashed yellow;
border-right: 3px solid green;
border-bottom: 3px groove black;
}
img{
border: 3px solid grey;
}