CSS | outline-width Property
The outline is the line that is created around the specified element outside the border of the element to make the particular distinct and easier to distinguish. The outline-width Property is used to specify the width of this outline for a specific element. The outline-style property must be declared or used before the outline-width property is used on the desired element. Logically an element must have an outline for which one defines or styles the width. The outline of an element is displayed around the margin of the element and is not the same as the border property. As the outline is not a part of the element’s dimensions, therefore the element’s width and height properties do not contain the width of the outline.
Syntax:
outline-width: medium|thin|thick|length|initial|inherit;
Property values:
- medium: This value sets the outline width to default.The width of the outline is thinner than the outline setas thick and thicker than the outline set as thin.
Syntax:
outline-width: medium;
Example 1:
html
< html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:medium; outline-style:solid;"> This paragraph has medium outline. </ p > </ body > </ html > |
Output:
- thin: This value sets the outline width to thin, the outline achieved is thinner than outline specified with width as medium and thick.
Syntax:
outline-width: thin;
Example 2:
html
< html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:thin; outline-style:solid;"> This paragraph has thin outline. </ p > </ body > </ html > |
Output:
- thick: This value sets the outline width to thick, the outline achieved is thicker than outline specified with width as medium and think.
Syntax:
outline-width: thick;
Example 3:
html
<!DOCTYPE html> < html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:thick; outline-style:solid;"> This paragraph has thick outline. </ p > </ body > </ html > |
Output:
- length: This value is used to define the thickness of the outline.
Syntax:
outline-width: 15px;
Example 4:
html
<!DOCTYPE html> < html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:15px; outline-style:solid;"> This paragraph has 15px outline. </ p > </ body > </ html > |
Output:
- initial: This value sets the outline -width to its default value.
Syntax:
outline-width: initial;
Example 5:
html
< html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:initial; outline-style:solid;"> This paragraph has initial outline. </ p > </ body > </ html > |
Output:
- inherit: This value inherits the specifications of outline-width property of parent.
Syntax:
outline-width: inherit;
Example 6:
html
<!DOCTYPE html> < html > < head > < title > CSS | outline-width Property </ title > </ head > < body > < p style = "outline-width:medium; outline-style:solid;"> This paragraph has medium outline. </ p > < p style = "outline-width:thin; outline-style:solid;"> This paragraph has thin outline. </ p > < br > < p style = "outline-width:thick; outline-style:solid;"> This paragraph has thick outline. </ p > < br > < p style = "outline-width:15px; outline-style:solid;"> This text has an outline of 15px. </ p > < br >< br > < p style = "outline-width:initial; outline-style:solid;"> This text has an outline of default type set by initial </ p > </ body > </ html > |
Output:
Supported Browsers: The browser supported by CSS | outline-width Property are listed below:
- Google Chrome 1.0 and above
- Edge 12.0 and above
- Internet Explorer 8.0 and above
- Firebox 1.5 and above
- Opera 7.0 and above
- Safari 1.2 and above
Please Login to comment...