Shorthand 用于 CSS 边界规则
Shorthand for CSS border rule
我只是想知道这个 CSS 规则是否有 shorthand。我想先定义边框然后在下一行通过指定不同的边框宽度覆盖它不是一个好主意。
我们能以某种方式简化它吗?
div.container {
border: 0 solid gray;
border-width: 5px 2px;
}
不幸的是没有shorthand border / border-wdith 属性 如果你没有为所有边设置相等的边框宽度。
(见)
等于边框宽度的示例:
div.container {
border: 5px solid gray;
}
或使用不同的边框宽度(您的情况)
div.container {
border: 0 solid gray;
border-width: 5px 2px;
}
我只是想知道这个 CSS 规则是否有 shorthand。我想先定义边框然后在下一行通过指定不同的边框宽度覆盖它不是一个好主意。 我们能以某种方式简化它吗?
div.container {
border: 0 solid gray;
border-width: 5px 2px;
}
不幸的是没有shorthand border / border-wdith 属性 如果你没有为所有边设置相等的边框宽度。
(见
等于边框宽度的示例:
div.container {
border: 5px solid gray;
}
或使用不同的边框宽度(您的情况)
div.container {
border: 0 solid gray;
border-width: 5px 2px;
}