- Services
- Case Studies
- Technologies
- NextJs development
- Flutter development
- NodeJs development
- ReactJs development
- About
- Contact
- Tools
- Blogs
- FAQ
CSS Border-Block-Start Simplified Border Styling
Use it to simplify border definitions, adaptable to various writing modes and text orientations.
Options include width, style, and color.
<border-width>
: The width of the border (e.g.,2px
,thin
,medium
,thick
).<border-style>
: The style of the border (e.g.,none
,dotted
,dashed
,solid
).<color>
: The color of the border (e.g.,blue
,#ff0000
).
Examples of Syntax
Values
The border-block-start
property can be specified using a combination of values:
<border-width>
:- Length values (e.g.,
2px
). - Keywords (
thin
,medium
,thick
).
- Length values (e.g.,
<border-style>
:none
,hidden
,dotted
,dashed
,solid
,double
,groove
,ridge
,inset
,outset
.
<color>
:- Any valid CSS color value (e.g.,
blue
,#ff0000
,rgb(255, 0, 0)
).
- Any valid CSS color value (e.g.,
Global Values:
inherit
: Inherits the value from its parent element.initial
: Sets the property to its default value.revert
: Rolls back to the default specified by the user agent.revert-layer
: Rolls back considering the cascade layer.unset
: Resets to inherited value if inheritable, or initial value if not.
Formal Definition
The border-block-start
property is a shorthand for setting the block-start border properties.
Initial Value
border-width
:medium
.border-style
:none
.color
:canvastext
.
Applies To
- All elements.
Inherited
- No, the property is not inherited.
Computed Value
border-width
: Absolute length or0
ifborder-style
isnone
orhidden
.border-style
: As specified.border-block-start-color
: Computed color.
Animation Type
border-block-start-color
: By computed value type.border-block-start-style
: Discrete.border-block-start-width
: By computed value type.
Examples
Here are some practical examples to illustrate the usage of border-block-start
:
Summary
The border-block-start
property is a versatile tool for setting the border at the start of the block direction. By combining width, style, and color in a single declaration, you can simplify your CSS and create more adaptable designs. This property is particularly useful for responsive web design, ensuring that your borders look great across different devices and writing modes.
Understanding border-block-start
The border-block-start
property in CSS is used to set the width, style, and color of the border at the start of the block direction. This is especially useful for different writing modes and directions, making your web designs more adaptable.
Key Values
inherit
: Takes the value from the parent element.initial
: Sets the property to its default value.revert
: Resets the value to the default specified by the browser.revert-layer
: Resets the value considering the cascade layer.unset
: Resets to its inherited value if it’s inheritable, or to its initial value if not.
Practical Examples
Basic Usage
HTML:
CSS:
Output: A blue, solid border with a width of 2 pixels at the start of the block direction.
Different Border Styles
HTML:
CSS:
Output: A green, dashed border with a width of 3 pixels at the start of the block direction.
Combining with Writing Mode
HTML:
CSS:
Output:
A red, dotted border with a width of 4 pixels at the start of the block direction, which is the right side due to the vertical-rl
writing mode.
Using Global Values
HTML:
CSS:
Output:
The child
element inherits the border style from the parent
element, resulting in a purple, solid border with a width of 5 pixels.
Complex Border with Text Orientation
HTML:
CSS:
Output:
An orange, solid border with a width of 5 pixels at the start of the block direction, which is the left side due to the vertical-lr
writing mode with upright
text orientation.
Border with Vertical Text
HTML:
CSS:
Output: The text is displayed vertically from right to left with a dashed blue border at the top of the text block.
Specifications
The border-block-start
property is defined in the CSS Logical Properties and Values Level 1 specification. This specification aims to make it easier to handle border properties in various writing modes and directions.
Browser Compatibility
The border-block-start
property is widely supported across modern browsers.
Desktop Browsers
- Google Chrome: Supported since version 69.
- Mozilla Firefox: Supported since version 41.
- Microsoft Edge: Supported since version 79.
- Safari: Supported since version 12.1.
- Opera: Supported since version 56.
Mobile Browsers
- Chrome for Android: Supported since version 69.
- Firefox for Android: Supported since version 41.
- Safari on iOS: Supported since version 12.1.
- Opera Mobile: Supported since version 56.
- Samsung Internet: Supported since version 10.0.
For the most up-to-date information, refer to Can I Use or MDN Web Docs.
See also
For further learning, check out these resources:
- CSS Logical Properties and Values: CSS Logical Properties and Values
- Related Border Properties:
border-block-end
,border-inline-start
,border-inline-end
,border-top
,border-right
,border-bottom
,border-left
- Writing Mode and Direction Properties:
writing-mode
,direction
,text-orientation
- Additional Resources: MDN Web Docs, Can I Use
Talk with CEO
We'll be right here with you every step of the way.
We'll be here, prepared to commence this promising collaboration.
Whether you're curious about features, warranties, or shopping policies, we provide comprehensive answers to assist you.