17

Hi,

what is the shorthand for border when borders have different width?

I tried this:

border:1px solid black, 2px solid black, 3px solid black, 4px solid black;

and this:

 border:1px 2px 3px 4px, solid, solid, solid, solid, black, black, black, black;

but none of them work.

Thank you.

1 Answer 1

31

Use

border: solid black;
border-width: 1px 2px 3px 4px;
2
  • I see. I thought there was a one-line shorthand for that. Thank you.
    – Cain Nuke
    May 25, 2016 at 12:42
  • 2
    border: solid black; should be written before border-width: 1px 2px 3px 4px; otherwise it is not going to work (so you cannot sort the css lines alphabetically). Jan 22, 2020 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.