CSS CSS Tutorial CSS Advanced CSS Responsive Web Design(RWD) CSS Grid CSS Properties Sass Tutorial Sass Functions



border-left-width

CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML (Hypertext Markup Language). CSS provides a wide range of properties to style the HTML elements. One of the properties is the border-left-width property, which is used to set the width of the left border of an element.

The border-left-width property is a part of the border shorthand property, which is used to set the width, style, and color of all four borders of an element. The border-left-width property sets the width of the left border of an element, while the border-top-width, border-right-width, and border-bottom-width properties set the width of the top, right, and bottom borders, respectively.

The value of the border-left-width property can be specified in different units such as pixels, ems, rems, percentages, etc. The default value of the border-left-width property is medium, which is typically equivalent to 3px.

Here are some examples of using the border-left-width property:

<p style="border-left-width: 1px solid black;">This is a paragraph with a left border of 1px width.</p>

<div style="border: 2px dashed red; border-left-width: 5px;">This is a div with a 5px wide left border.</div>

<h2 style="border-left: 10px solid blue;">This is an h2 element with a 10px wide left border.</h2>

In the first example, the border-left-width property is used to set the width of the left border of a paragraph to 1px and the style to solid and color to black. In the second example, the border-left-width property is used along with the border shorthand property to set the width of the left border of a div to 5px, while the other borders are set to 2px width, dashed style, and red color. In the third example, the border-left property is used to set the width, style, and color of the left border of an h2 element to 10px, solid, and blue, respectively.

The border-left-width property can also be used in combination with other border properties to create different border styles. For example:

<p style="border: 2px solid black; border-left-width: 10px;">This is a paragraph with a 10px wide left border and a 2px wide solid black border.</p>

<div style="border: 5px double green; border-left-style: dashed; border-left-color: blue;">This is a div with a 5px wide double green border and a 10px wide dashed blue left border.</div>

In the first example, the border shorthand property is used to set the width, style, and color of a 2px wide solid black border, while the border-left-width property is used to set the width of the left border to 10px. In the second example, the border shorthand property is used to set the width, style, and color of a 5px wide double green border, while the border-left-style and border-left-color properties are used to set the style and color of the left border to dashed and blue, respectively.

The border-left-width property is a useful property for creating different border styles and adding emphasis to specific sides of an element. It is important to note that the border-left-width property only sets the width of the left border and does not affect the width of the content or padding of an element.

References:

Activity