Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:46:13+00:00 2026-06-05T14:46:13+00:00

Can we shorten : border-top:1px solid black; border-left:2px solid red; border-bottom:3px solid green; border-right:4px

  • 0

Can we shorten :

border-top:1px solid black;
border-left:2px solid red;
border-bottom:3px solid green;
border-right:4px solid blue;

To something similar to :

border:1px solid black 2px solid red 3px solid green 4px solid blue;

N.B: I know already this way:

border-width:1px 2px 3px 4px;
border-style:solid;
border-color:black red green blue;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:46:15+00:00Added an answer on June 5, 2026 at 2:46 pm

    Nope, you can’t make it any shorter than the examples you’ve provided.

    From the docs

    Unlike the shorthand ‘margin’ and ‘padding’ properties, the ‘border’
    property cannot set different values on the four borders. To do so,
    one or more of the other border properties must be used.

    Thanks @Rocket


    If you are using a preprocessor (like SCSS), you could try and use a mixin, but I hardly believe that’s what you want:

    @mixin border_shorthand(
    $top_width, $top_color, $top_style,
    $left_width, $left_color, $left_style,
    $bottom_width, $bottom_color, $bottom_style,
    $right_width, $right_color, $right_style) {
      border-top: $top_width $top_color $top_style;
      border-left: $left_width $left_color $left_style;
      border-bottom: $bottom_width $bottom_color $bottom_style;
      border-right: $right_width $right_color $right_style;
    }
    
    .element {
      @include border_shorthand(1px, black, solid, 2px, red, solid, 3px, green, solid, 4px, blue, solid);
    }
    

    Which outputs:

    .element {
      border-top: 1px black solid;
      border-left: 2px red solid;
      border-bottom: 3px green solid;
      border-right: 4px blue solid; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following: <div style=border:solid 1px gray; height:22px; line-height:22px; display:inline-block;>Div</div> <input style=border:solid 1px
html: <div id=thumbnail> <img src=xxx> </div> css: div.thumbnail { border: 2px solid #ccc; width:
I have a div with different colors for both the border-bottom and border-right properties.
You can control the width of a border using the border-right-width property. Is there
How can I shorten the definition of my custom routes in Zend Framework? I
Normally a left-orientated JLabel shortens text at the right by adding periods, e.g. Hello
How can I shorten this code? Each css selector increases +1. All Bio's divs
If I have a string this is a string How can I shorten it
I'm new to ruby. Is there any way how can I shorten this code?
How can i shorten this code? I want to return all values except abc

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.