Colors can be specified in several ways:
h1 { color: red; }
p { color: navy; }
h1 { color: #ff0000; }
p { color: #000080; }
h1 { color: rgb(255, 0, 0); }
div { background: rgba(0, 0, 255, 0.5); }
h1 { color: hsl(0, 100%, 50%); }
div { background: hsla(240, 100%, 50%, 0.5); }
body { background-color: #f4f4f4; }
header {
background-image: url("banner.jpg");
}
Borders have three properties: width, style, and color.
div {
border-width: 2px;
border-style: solid;
border-color: #333;
}
div {
border: 2px solid #333;
}
Margin creates space outside the element. Padding creates space inside the element, between the content and the border.
div {
margin: 20px;
padding: 15px;
}
div {
height: 200px;
width: 50%;
}
An outline is drawn outside the border edge and does not affect layout.
input:focus {
outline: 2px solid blue;
}
Create a card component with a background color, a solid border, rounded corners (use border-radius), padding inside, and a margin around it.