CSS Borders [Autosaved]
CSS Borders [Autosaved]
p.two {
border-style: solid;
border-width: medium;
}
p.three {
border-style: dotted;
border-width: 2px;
CSS Border Color
The border-color property is used to set the color of the four borders.
The color can be set by:
•name - specify a color name, like "red"
•HEX - specify a HEX value, like "#ff0000"
•RGB - specify a RGB value, like "rgb(255,0,0)"
•HSL - specify a HSL value, like "hsl(0, 100%, 50%)"
•transparent
border-style: solid;
border-color: red;
}
p.two {
border-style: solid;
border-color: green;
}
Specific Side Colors
• The border-color property can have from one to four values (for the
top border, right border, bottom border, and the left border)
• border-style: solid;
border-color: red green blue yellow; /* red top,
green right, blue bottom and yellow left
CSS Border Sides
• From the examples on the previous pages, you have seen that it is possible to
specify a different border for each side.
• In CSS, there are also properties for specifying each of the borders (top, right,
bottom, and left):
• p {
border-top-style: dotted;
border-right-style: solid;
border-bottom-style: dotted;
border-left-style: solid;
}
CSS Border - Shorthand Property
•border-width
•border-style (required)
•border-color
p {
border: 5px solid red;
}
p {
border-left: 6px solid red;
}
CSS Rounded Borders
• p {
border: 2px solid red;
border-radius: 5px;
}
• Normal border
• Round border
• Rounder border
• Roundest border