Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
The -webkit-border-before
CSS property is a shorthand property for setting the individual logical block start border property values in a single place in the style sheet.
/* Border values */ -webkit-border-before: 1px; -webkit-border-before: 2px dotted; -webkit-border-before: medium dashed blue; /* Global values */ -webkit-border-before: inherit; -webkit-border-before: initial; -webkit-border-before: unset;
-webkit-border-before
can be used to set the values for one or more of: -webkit-border-before-width
, -webkit-border-before-style
, and -webkit-border-before-color
. It maps to a physical border depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top
, border-right
, border-bottom
, or border-left
property depending on the values defined for writing-mode
, direction
, and text-orientation
.
It relates to -webkit-border-after
, -webkit-border-start
, and -webkit-border-end
, which define the other borders of the element.
This property is on the standard track as border-block-start
.
Syntax
Values
One or more of the following, in any order:
<'border-width'>
- See
border-width
<'border-style'>
- See
border-style
<'color'>
- See
color
Formal definition
Initial value |
as each of the properties of the shorthand:
|
Applies to | all elements |
Inherited | yes |
Percentages |
as each of the properties of the shorthand:
|
Computed value |
as each of the properties of the shorthand:
|
Animation type | discrete |
Formal syntax
<'border-width'> || <'border-style'> || <'color'>where <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle>
Examples
Applying a border with vertical text
HTML
<div>
<p class="exampleText">Example text</p>
</div>
CSS
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-rl;
-webkit-border-before: 5px dashed blue;
}
Result
Specifications
Not part of any standard, but it relates to the standards-track border-block-start
property.
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 8 |
Edge
Full support 79 |
Firefox
No support No |
IE
No support No |
Opera
Full support 15 |
Safari
Full support 5.1 |
WebView Android
Full support 37 |
Chrome Android
Full support 18 |
Firefox Android
No support No |
Opera Android
Full support 15 |
Safari iOS
Full support 5.1 |
Samsung Internet Android
Full support 1.0 |
Legend
- Full support
- Full support
- No support
- No support
- Non-standard. Expect poor cross-browser support.'
- Non-standard. Expect poor cross-browser support.
See also
border-block-start
- The mapped physical properties:
border-top
,border-right
,border-bottom
, andborder-left
writing-mode
,direction
,text-orientation
-webkit-border-before by Mozilla Contributors is licensed under CC-BY-SA 2.5.