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

后端 未结 5 1190
长情又很酷
长情又很酷 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:53

    I can relate to the problem, there should be a shorthand like...

    border: 1px solid red top bottom left;
    

    Of course that doesn't work! Kobi's answer gave me an idea. Let's say you want to do top, bottom and left, but not right. Instead of doing border-top: border-left: border-bottom: (three statements) you could do two like this, the zero cancels out the right side.

    border: 1px dashed yellow;
    border-width:1px 0 1px 1px;
    

    Two statements instead of three, small improvement :-D

提交回复
热议问题