No, you cannot set them all in a single statement.
At the general case, you need at least three properties:
border-color: red green white blue;
border-style: solid dashed dotted solid;
border-width: 1px 2px 3px 4px;
However, that would be quite messy. It would be more readable and maintainable with four:
border-top: 1px solid #ff0;
border-right: 2px dashed #f0F;
border-bottom: 3px dotted #f00;
border-left: 5px solid #09f;
Answer from Kobi on Stack OverflowMDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › border-top-width
border-top-width - CSS | MDN
October 30, 2025 - The border-top-width CSS property sets the width of the top border of an element.
W3Schools
w3schools.com › cssref › pr_border-top_width.php
CSS border-top-width property
The border-top-width property sets the width of an element's top border.
Videos
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › border-top
border-top - CSS - MDN Web Docs - Mozilla
August 13, 2025 - border-top = <line-width> || <line-style> || <color> <line-width> = <length [0,∞]> | thin | medium | thick <line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset
W3Schools
w3schools.com › cssref › pr_border-top.php
CSS border-top property
border-top: border-width border-style border-color|initial|inherit; ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] · If you want to report an error, or if ...
Codrops
tympanus.net › codrops › css_reference › border-top-width
border-top-width | Codrops
February 3, 2015 - The border-top-width property is used to set the width of the top border of an element. The width of the border can be e
Top answer 1 of 5
224
No, you cannot set them all in a single statement.
At the general case, you need at least three properties:
border-color: red green white blue;
border-style: solid dashed dotted solid;
border-width: 1px 2px 3px 4px;
However, that would be quite messy. It would be more readable and maintainable with four:
border-top: 1px solid #ff0;
border-right: 2px dashed #f0F;
border-bottom: 3px dotted #f00;
border-left: 5px solid #09f;
2 of 5
31
Your case is an extreme one, but here is a solution for others that fits a more common scenario of wanting to style fewer than 4 borders exactly the same.
border: 1px dashed red; border-width: 1px 1px 0 1px;
that is a little shorter, and maybe easier to read than
border-top: 1px dashed red; border-right: 1px dashed red; border-left: 1px dashed red;
or
border-color: red; border-style: dashed; border-width: 1px 1px 0 1px;
Fandom
htmlcss.fandom.com › wiki › Border-top-width
Border-top-width | HTML & CSS Wiki | Fandom
The border-top-width property is used in CSS and certain HTML elements. This property controls the thickness (width) of the top side of the border of an element's rendering box. Negative values are not allowed.
Uwinnipeg
theory.uwinnipeg.ca › css › box › border-top-width.html
Top Border Width
The border-top-width property is used to specify the width of an element's top border. The value may be one of three keywords, which are not affected by font size, or a length, which can be used to achieve relative widths.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › border-width
border-width - CSS - MDN Web Docs - Mozilla
August 13, 2025 - border-width = <'border-top-width'>{1,4} <border-top-width> = <line-width> <line-width> = <length [0,∞]> | thin | medium | thick
HowDev
how.dev › answers › what-is-the-css-border-top-property
What is the CSS border-top property?
September 28, 2021 - Defines the top border's width, style, and color; requires border-top-style.
TutorialsPoint
tutorialspoint.com › css › css_border-top-width.htm
CSS - border-top-width Property
CSS border-top-width property determines the width of the top border of an element. The border-style or border-top-style must be declared before using this property.
W3Schools
w3schools.com › cssref › pr_border-top_style.php
CSS border-top-style property
div { border-top-style: groove; border-top-color: coral; border-top-width: 7px; } Try it Yourself »
Techbrood
techbrood.com › en › cssref
CSS border-top Property | CSS Reference, CSS3 Reference | TechbrooD.com
border-top: border-width border-style border-color|initial|inherit;
HTML Dog
htmldog.com › references › css › properties › border-top-width
CSS Property: border-top-width | HTML Dog
The width of the top border of a box, above the content and padding areas and before the top margin area.