</> Code Corner

CSS · CSS Tutorial · Lesson 8

CSS Borders

Border style, width, color and radius.

The border properties specify the style, width and color of an element's border.

Example

<style>
p { padding: 8px; }
.dotted { border-style: dotted; }
.dashed { border: 2px dashed tomato; }
.solid { border: 4px solid #04AA6D; }
.double { border-style: double; border-width: 6px; }
.rounded { border: 2px solid dodgerblue; border-radius: 12px; }
.left { border-left: 6px solid red; background: #ffeeee; }
</style>
<p class="dotted">Dotted</p>
<p class="dashed">Dashed</p>
<p class="solid">Solid</p>
<p class="double">Double</p>
<p class="rounded">Rounded</p>
<p class="left">Only left border</p>
Tip: The shorthand order is border: width style color;. The style is required.

Keep reading “CSS Borders”

Sign up to read the full lesson, try every example in the live editor, and take the 5-question quiz.

Chat with us 👋