Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the outline-width attribute in css

Shulou Source: shulou.com Published: 2022-06-01 12:16:28 10月02日 Update

This article mainly introduces how to use the outline-width attribute in css, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Definition and usage of cssoutline-width attribute

1. In css, the outline-width attribute is used to set the width of the outline, which is a line drawn around the element, located on the periphery of the edge of the border, not part of the size of the element, so the width and height attributes of the element do not contain the width of the outline. Unlike the border, the outline does not take up space and may be non-rectangular.

two。 If you need to set multiple attributes of the outline of an element at the same time, it is recommended to use the outline shorthand attribute. Through the outline attribute, you can simplify the code and define multiple attributes of the outline in a declaration. The outline attributes that can be set are (in order): outline-color, outline-style, outline-width.

The cssoutline-width attribute must be used with the outline-style attribute, which is understandable, and the element must have an outline (the outline-style attribute defines the outline style) to set the width of the outline.

Cssoutline-width attribute syntax format

Css syntax: outline-width:thin/medium/thick/length/inherit

JavaScript syntax: object.style.outlineWidth= "thin"

Attribute value description

1.thin: defining thin profil

2.medium: define medium profile (default)

3.thick: define thick outlines

4.length: allows you to specify a value for outline thickness

5.inherit: inherits the value of the outline-width attribute from the parent element

Case study

The cssoutline-width property sets the outline width

Div {width:300px;height:60px;border:1pxsolid#000;margin-top:15px;outline-style:dotted;}

# div1 {outline-width:thin;} / * thin outline * /

# div2 {outline-width:thick;} / * bold outline * /

# div3 {outline-width:8px;} / * Custom profile width is 8px*/

Thin

Thick

8px

Thank you for reading this article carefully. I hope the article "how to use outline-width attributes in css" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Outline attribute element width article grammar simultaneously multiple border different code value interest example that is size suggestion right and wrong more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Shulou Tech Info Docker macOS