在CSS中组合边框顶部,边框右边,边框左边,边框底部 [英] Combining border-top,border-right,border-left,border-bottom in CSS

查看:120
本文介绍了在CSS中组合边框顶部,边框右边,边框左边,边框底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法可以将边框顶部,边框右边,边框左边,边框底部在CSS中组合成一个超级速记样式。

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

例如:

border: (1px solid #ff0) (2px dashed #f0F) (3px dotted #F00) (5px solid #09f);


推荐答案

不,你不能在一个语句。

在一般情况下,您至少需要三个属性:

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;

这篇关于在CSS中组合边框顶部,边框右边,边框左边,边框底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆