CSS Outlines

CSS Outlines
Nikhil
Published on 2021-07-08 09:06:13

Parameter details:


  • dotted - dotted outline
  • dashed - dashed outline
  • solid-  solid outline
  • double-  double outline
  • groove-  3D grooved outline depends on the outline-color value
  • ridge-  3D ridged outline depends on the outline-color value
  • inset-  3D inset outline depends on the outline-color value
  • outset-  3D outset outline depends on the outline-color value
  • none-  no outline
  • hidden-  hidden outline

 

Overview


The outline is a line that goes around the element, outside of the border. In contrast to borders, outlines do not take any space in the box model. So adding an outline to an element does not affect the position of the element or other elements.

In addition, outlines can be non-rectangular in some browsers. This can happen if the outline is applied to a span element that has text with different font-size properties inside it. Unlike borders, outlines cannot have rounded corners.

The essential parts of the outline are outline-color, outline-style, and outline-width.

The definition of an outline is equivalent to the definition of a border:

outline: 1px solid black;

 

Outline-style


The outline-style property is used to set the style of the outline of an element.

CSS 

p
{
  border: 1px solid black;
  outline-color: blue;
  line-height: 30px;
}
.p1
{
  outline-style: dotted;
}
.p2
{
  outline-style: dashed;
}
.p3
{
  outline-style: solid;
}
.p4{
outline-style: double;
}
.p5{
outline-style: groove;
}
.p6{
outline-style: ridge;
}
.p7{
outline-style: inset;
}
.p8{
outline-style: outset;
}

HTML:

<p class="p1">A dotted outline</p>
<p class="p2">A dashed outline</p>
<p class="p3">A solid outline</p>
<p class="p4">A double outline</p>
<p class="p5">A groove outline</p>
<p class="p6">A ridge outline</p>
<p class="p7">An inset outline</p>
<p class="p8">An outset outline</p>

border atutorialhub

 

ATutorialHub Related Guide

Comments (8)

Leave a Comment

Your email address will not be published. Required fields are marked*

User Comments

html tutorial comments

panduranga gupta

2021-07-05 07:03:13

good website for learning and help me a lot

html tutorial comments

raju

2021-09-25 14:58:47

The awsome website i am looking like for a long time, good work atutorialhub team keep doing

html tutorial comments

Shivani

2021-09-01 15:03:56

Learning a lot from the courses present on atutorialhub. The courses are very well explained. Great experience

html tutorial comments

Harshitha

2021-09-10 15:05:45

It is very helpful to students and easy to learn the concepts

html tutorial comments

Sowmya

2021-09-14 15:06:41

Great job Tutorials are easy to understand Please make use of it

html tutorial comments

Zain Khan

2021-09-18 15:07:23

Great content and customized courses.

html tutorial comments

Rudrakshi Bhatt

2021-09-09 15:08:10

Well structured coursed and explained really well!

html tutorial comments

Pavana Somashekar

2021-09-11 15:09:08

Good platform for beginners and learn a lot on this website