CSS Part 2
CSS Part 2
CSS background properties are used to define the background effects for elements
CSS background properties:
background-color
background-image
background-repeat
background-attachment
background-position
background-size (CSS3)
background-origin (CSS3)
background-clip (CSS3)
body {
background-image: url("images/tree.png");
background-repeat: no-repeat;
background-position: right top;
margin-right: 200px;
}
p.color_one {
border-style: solid;
border-color: red;
}
p.color_two {
border-style: solid;
border-color: red green blue yellow;
}
p.individual_sides {
border-top-style: dotted;
border-right-style: solid;
border-bottom-style: dotted;
border-left-style: solid;
}
You can also specify all the individual border properties for just one side:
p.leftBorder {
border-left: 6px solid red;
background-color: lightgrey;
}
p.normal {
border: 2px solid red;
}
p.round1 {
border: 2px solid red;
border-radius: 5px;
}
p.round2 {
border: 2px solid red;
border-radius: 8px;
}
p.round3 {
border: 2px solid red;
border-radius: 12px;
}
div2 {
width: 300px;
margin: auto;
border: 1px solid red;
}
In the example above, the <h1> element has a bottom margin of 20px and the <h2> element
has a top margin set to 20px.
Common sense would seem to suggest that the vertical margin between the <h1> and the <h2>
would be a total of 40px. But due to margin collapse, the actual margin ends up being 20px.
div {
width: 50%;
height: 200px;
background-color: powderblue;
}