Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS边框规则的简写_Html_Css_Border_Shorthand - Fatal编程技术网

Html CSS边框规则的简写

Html CSS边框规则的简写,html,css,border,shorthand,Html,Css,Border,Shorthand,我只是想知道这个CSS规则是否有一个缩写。我想先定义边界,然后在下一行中通过指定不同的边界宽度来覆盖它不是一个好主意。 我们能简化它吗 div.container { border: 0 solid gray; border-width: 5px 2px; } 不幸的是,如果没有为所有边设置等于边框宽度,则边框/border wdith属性没有速记 (见附件) “等于边框宽度”的示例: div.container { border: 5px solid gray; } 或使用不同

我只是想知道这个CSS规则是否有一个缩写。我想先定义边界,然后在下一行中通过指定不同的边界宽度来覆盖它不是一个好主意。 我们能简化它吗

div.container {
  border: 0 solid gray;
  border-width: 5px 2px;
}

不幸的是,如果没有为所有边设置等于边框宽度,则边框/border wdith属性没有速记

(见附件)

“等于边框宽度”的示例:

div.container {
  border: 5px solid gray;
}
或使用不同的边框宽度(您的案例)


为什么它不好,如果它的工作?如果您希望每边都有不同的边框,您没有其他方法,您至少需要两个more()声明,您可以删除0。但其余的必须保持不变。
div.container {
  border: 0 solid gray;
  border-width: 5px 2px;
}