Curriculum
Course: CSS
Login

Curriculum

CSS

CSS INTRODUCTION

0/1

CSS Selectors

0/1

CSS Comments

0/1

CSS Padding

0/1

CSS Box Model

0/1

CSS Combinators

0/1

CSS Pseudo-classes

0/1

CSS Pseudo-elements

0/1

CSS Dropdowns

0/1

CSS Image Gallery

0/1

CSS Image Sprites

0/1

CSS Counters

0/1

CSS Website Layout

0/1

CSS Specificity

0/1

CSS Math Functions

0/1
Text lesson

Outline Color

The outline-color property is utilized to define the color of the outline.

Color can be specified using:

  • Name: Indicate a color name, such as “red”
  • HEX: Specify a hexadecimal value, like “#ff0000”
  • RGB: Define an RGB value, such as “rgb(255,0,0)”
  • HSL: Specify an HSL value, like “hsl(0, 100%, 50%)”
  • Invert: Utilize color inversion (ensuring the outline remains visible irrespective of the background color).

The subsequent example displays various outlines in different colors. Additionally, observe that these elements feature a narrow black border within the outline.

Image

Example

p.ex1 {
  border: 2px solid black;
  outline-style: solid;
  outline-color: red;
}

p.ex2 {
  border: 2px solid black;
  outline-style: dotted;
  outline-color: blue;
}

p.ex3 {
  border: 2px solid black;
  outline-style: outset;
  outline-color: grey;
}

HEX Values

The color of the outline can alternatively be specified using a hexadecimal value (HEX).

Example

p.ex1 {
  outline-style: solid;
  outline-color: #ff0000; /* red */
}

RGB Values

Alternatively, RGB values can be used to specify the outline color.

Example

p.ex1 {
  outline-style: solid;
  outline-color: rgb(255, 0, 0); /* red */
}

HSL Values

HSL values are also an option for specifying the outline color.

Example

p.ex1 {
  outline-style: solid;
  outline-color: hsl(0, 100%, 50%); /* red */
}

 

Explore further details about HEX, RGB, and HSL color values within our CSS Colors sections.