Combining border-top,border-right,border-left,border-bottom in CSS

后端 未结 5 1178
长情又很酷
长情又很酷 2020-12-03 13:02

Is there a way of combining border-top,border-right,border-left,border-bottom in CSS like a super shorthand style.

eg:

border: (1px solid #ff0) (2px         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 13:42

    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;
    

提交回复
热议问题