CSS Outline Width Property Explained

 CSS Outline Width Property Explained

This Blog You Will Learn

 ஃ  What is CSS outline width
 ஃ  Syntax:
 ஃ  CSS Outline Width Property  Program 
 ஃ  Explain Program
 ஃ  Output

What is CSS outline width

✔ Outline-width property in css defines thickness of the outline drawn around element.

✔ Outline is a line that appears  outside the border  of an element.

✔ Mainly use highlight elements especially for focus states 

Syntax:

selector
{
outline-width: value;
}

outline to appear

outline-style: value;

CSS Outline Width Property 

Program 

<!DOCTYPE html>
<html>
<head>
<style>
p {
  padding: 5px;
  outline-style: solid;
  outline-color: blue;
}

p.box1 {
  outline-width: thin;
}

p.box2 {
  outline-width: medium;
}

p.box3 {
  outline-width: thick;
}

p.box4 {
  outline-width: 8px;
}
</style>
</head>
<body>

<h2>CSS Outline Width Property Explained</h2>

<p class="box1">CSS Outline Property - thin.</p>
<p class="box2">CSS Outline Property -  medium.</p>
<p class="box3">CSS Outline Property - thick.</p>
<p class="box4">CSS Outline Property - 8px thick.</p>

</body>
</html>

CSS Outline Width Property Explained
Explain Program

Step  1] 

<!DOCTYPE html>

  • This declare the document type.
  • browser that the document is written in html

Step 2]  

<html>.... . </html>

  • html is the root element of the html page.
  •  Every thing inside it is part of the webpage.

Step 3]

<head>

  • <head> section  contains metadata and css styles,not visible content.

  • Contains styles, metadata and page setting 

Step 4

<style> tag Internal CSS Section

p {
  padding: 5px;
  outline-style: solid;
  outline-color: blue;
}

Padding : 5px;

  •  Add space inside paragraph.
  • creates space between text and outline.

outline-style: solide;

  • outline visible.

outline-color: blue;

  • set outline color to blue.

Outline Width Classes


p.box1 {
  outline-width: thin;
}

  • sets outline thickness to thin.
  • predefined keyword.


p.box2 {
  outline-width: medium;
}

  • set outline thickness  to medium.
  • Medium is the default value.


p.box3 {
  outline-width: thick;
}

  • sets outline thickness to thick.
  • makes outline wider.


p.box4 {
  outline-width: 8px;
}

  • Sets customer thickness use 8 pixels.
  • This fixed size value.

Step 4

Closing tag
</style>
</head>

Step 5

Body Section


<body>

<h2>CSS Outline Width Property Explained</h2>

  • Display heading on webpage.


<p class="box1">CSS Outline Property - thin.</p>
<p class="box2">CSS Outline Property -  medium.</p>
<p class="box3">CSS Outline Property - thick.</p>
<p class="box4">CSS Outline Property - 8px thick.</p>

  • Each paragraph use different class.
  • Each class applies a different outline-width value.

Step 6]

Closing tag


  </body>
</html>

CSS Outline Width Property Explained

Output

CSS Outline Width Property Explained


Related Post :-



Comments

Popular posts from this blog

What Is CSS Text Color in 2026

CSS Padding Property Explained

CSS Outline Color Property in 2026