Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Topics

CSS border-right-style Property

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

Photo Credit to CodeToFun

🙋 Introduction

The border-right-style property in CSS is used to specify the style of the right border of an element.

This property allows you to define how the right edge of an element should be displayed, whether as a solid line, a dashed line, or even no line at all. It is a crucial part of styling borders, especially when you want to have different styles for different sides of an element.

💡 Syntax

The syntax for the border-right-style property is simple and follows the general pattern of other border-related properties.

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

Here, value can be any of the predefined border styles such as solid, dashed, dotted, etc.

🎛️ Default Value

The default value of the border-right-style property is none, meaning no border is displayed on the right side of the element unless explicitly defined.

🏠 Property Values

The border-right-style property supports several values, each determining a different style for the right border:

ValueDescription
noneNo border is displayed (this is the default value).
solidA solid line border.
dashedA dashed line border.
dottedA dotted line border.
doubleA double line border.
grooveA 3D grooved border.
ridgeA 3D ridged border.
insetA 3D inset border.
outsetA 3D outset border.
hiddenThe border is hidden, similar to none but still affects the element's layout.

📄 Example

In this example, we'll set the right border style of a box to be solid.

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-style Example</title>
  <style>
    .box {
      border-right-style: solid;
      border-width: 5px;
      border-color: #3498db;
      padding: 20px;
      width: 200px;
    }
  </style>
</head>
<body>
  <h1>Box with Solid Right Border</h1>
  <div class="box">
    This box has a solid right border.
  </div>
</body>
</html>

🖥️ Browser Compatibility

The border-right-style property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is a well-established property, so you can use it confidently across various platforms without compatibility concerns.

🎉 Conclusion

The border-right-style property is a fundamental tool for web developers when it comes to styling the borders of elements. It offers a wide range of styles, allowing you to tailor the appearance of the right border to match the design of your website. Whether you need a subtle dotted line or a bold solid border, this property provides the flexibility you need to create visually appealing layouts.

👨‍💻 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