Javatpoint Logo
Javatpoint Logo

CSS Border Bottom

The border-bottom property in CSS (Cascading Style Sheets) is used to specify the width, color, and style of an element's bottom border. It is a component of the larger class of border properties that lets you manage an element's borders. Three values are possible for the border-bottom property: border-bottom-color, border-bottom-style, and border-bottom-width.

Now, let's examine each of the characteristics linked to the border-bottom shorthand in more detail:

1. Bottom-border-width:

Description: This property establishes the bottom border's width.

Values: It accepts a range of units, including percentages (%), em units, pixels (px), and so on.

Examples:

This establishes a dashed line style for the bottom border.

3. Border-bottom-color:

Description: This property sets the color of the bottom border.

Values: It can be set using color names, hexadecimal values, RGB values, etc.

Example:

This changes the bottom border's color to a blue tint.

4. Border-bottom (shorthand):

Description: This is a shorthand property that contains all three declarations for border-bottom-color, border-bottom-style, and border-bottom-width.

Syntax:

Example:

This sets the width to 2px, the style to dashed, and the color to #336699 for the bottom border.

5. Border-bottom-left-radius and border-bottom-right-radius:

Description: These properties define the radii of the bottom-left and bottom-right corners, respectively, creating rounded corners.

Values: They accept length values (e.g., px, em) or percentages.

Example:

This creates a border with the rounded bottom-left corner of 10px and a rounded bottom-right corner of 20%.

6. Border-bottom-image:

Description: This property allows you to use an image as the bottom border.

Values: It takes values like none (default), url(), linear-gradient(), etc.

Example:

This sets the bottom border using an image or a gradient.

7. Border-bottom-left-radius and border-bottom-right-radius:

Description: These properties define the radii of the bottom-left and bottom-right corners, respectively, creating rounded corners.

Values: They accept length values (e.g., px, em) or percentages.

Example:

This produces a border with 10% rounded bottom-right and 10px rounded bottom-left and bottom-right corners.

8. Border-bottom with outline:

Description: The border-bottom property can also be combined with the outline property to create a border and an outline around an element.

Example:

This creates a 2px solid blue bottom border and a 2px solid red outline around the element.

You can achieve a wide range of visual effects for your web page elements by customizing and styling borders in CSS with the help of these extra properties and features.

It's usually more convenient to use the shorthand property, particularly if you want to set the border's entire attributes in a single line. It lessens redundancy and enhances code readability.

Conclusion

The border-bottom property in CSS is a flexible tool for styling an element's bottom border. It consists of the following three fundamental parts: border-bottom-color to specify the color; border-bottom-style to choose the line style (solid, dashed, dotted, etc.); and border-bottom-width to set the width. Code is made more streamlined and readable by combining these attributes into a shorthand declaration. Round bottom corners are also added by the border-bottom-left-radius and border-bottom-right-radius properties, providing a subtle visual. The border-bottom-image property permits gradients or images to be used as the bottom border for more complex designs.

Additionally, by enclosing the element in an outline, developers can produce unique visual effects by combining border-bottom with the outline property. Together, these characteristics give web developers a complete toolkit to create a variety of border styles, ranging from straightforward, solid lines to intricate gradients or even incorporating images. Because of the flexibility these properties provide, designers can create precise and eye-catching visual effects for the bottom borders of HTML elements, which enhances a web page's overall appearance and user experience.

With CSS, developers can precisely alter an element's bottom border by using the border-bottom property and its related properties. These attributes provide a variety of options for producing visually appealing and unique design elements, from changing width, style, and color to adding rounded corners and images or gradients.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA