Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Properties

CSS border-block-start-width Property

Posted in CSS Tutorial
Updated on Oct 01, 2024
By Mari Selvan
👁️ 11 - Views
⏳ 4 mins
💬 1 Comment
CSS border-block-start-width Property

Photo Credit to CodeToFun

🙋 Introduction

The border-block-start-width property in CSS is a logical property that allows you to set the width of the border on the start side of the block in a block-level element. The "start" side is determined by the writing mode of the document or the block's container.

This property is part of CSS Logical Properties, which provide a way to control layout by using terms that depend on the writing mode, directionality, and text orientation of the document.

💡 Syntax

The syntax for the border-block-start-width property is as follows:

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

Here, value can be a specific width, such as a length (e.g., 2px, 0.5em), or keywords like thin, medium, thick.

🎛️ Default Value

The default value of the border-block-start-width property is medium, which typically corresponds to a width of around 3-4 pixels, but this can vary depending on the browser.

🏠 Property Values

ValueDescription
lengthSpecifies the width of the border using any valid CSS length unit (e.g., px, em, rem).
thinA keyword representing a thin border width.
mediumA keyword representing a medium border width. This is the default value.
thickA keyword representing a thick border width.

📄 Example

In this example, we'll set the width of the border on the start side of a block element to 5 pixels.

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-block-start-width Example</title>
  <style>
    .box {
      border-block-start-width: 5px;
      border-block-start-style: solid;
      border-block-start-color: black;
      padding: 20px;
      background-color: lightgray;
    }
  </style>
</head>
<body>
  <h1>Block Element with Custom Border Block Start Width</h1>
  <div class="box">
    This block element has a 5px wide border on the block start side.
  </div>
</body>
</html>

🖥️ Browser Compatibility

The border-block-start-width property is supported in most modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. However, as always, it's recommended to test your design across various browsers to ensure consistent rendering.

🎉 Conclusion

The border-block-start-width property is a flexible way to control the width of the start-side border in a block-level element, especially in documents that use different writing modes or text orientations. By using logical properties like this, you can create layouts that are more adaptable to various languages and writing directions, ensuring a more robust and accessible design.

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