Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Topics

CSS border-right-width Property

Posted in CSS Tutorial
Updated on Oct 02, 2024
By Mari Selvan
👁️ 16 - Views
⏳ 4 mins
💬 1 Comment
CSS border-right-width Property

Photo Credit to CodeToFun

🙋 Introduction

The border-right-width property in CSS is used to set the width of the right border of an element.

This property allows you to control the thickness of the right border, enhancing the visual appearance of your elements. It is commonly used in conjunction with other border properties such as border-style and border-color to create well-defined borders around elements.

💡 Syntax

The syntax for the border-right-width property is simple. It can be applied to any element that supports borders.

Syntax
Copied
Copy To Clipboard
element {
  border-right-width: value;
}

🎛️ Default Value

The default value of the border-right-width property is medium, which is typically 3-4 pixels, but it can vary slightly between browsers.

🏠 Property Values

ValueDescription
thinA thin right border, typically around 1px.
mediumA medium right border, usually around 3-4px. (This is the default value.)
thickA thick right border, generally around 5-6px.
lengthA specific width defined in units like px, em, rem, etc.
inheritInherits the border-right-width value from its parent element.

📄 Example

In this example, we’ll set the right border width of a div element to 10px.

index.html
Copied
Copy To Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS border-right-width Example</title>
  <style>
    div {
      border-style: solid;
      border-right-width: 10px;
      border-color: black;
    }
  </style>
</head>
<body>
  <h1>Div with Custom Right Border Width</h1>
  <div>This div has a right border width of 10px.</div>
</body>
</html>

🖥️ Browser Compatibility

The border-right-width property is well-supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. As it is a fundamental CSS property, you can rely on it to work consistently across different platforms and devices.

🎉 Conclusion

The border-right-width property provides a simple yet effective way to control the width of the right border of an element. By adjusting this property, you can create distinct visual effects and improve the overall design of your web pages. Experiment with different values to see how this property can be used to enhance the layout of your content.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.

Buy me a coffee to make codetofun.com free for everyone.

Buy me a Coffee

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy