--- title: border-block slug: Web/CSS/border-block translation_of: Web/CSS/border-block ---
该CSS属性是一个简写属性在样式表一个单一的地方设置单独的逻辑块边界属性值。border-block
border-block: 1px; border-block: 2px dotted; border-block: medium dashed blue;
border-block
can be used to set the values for one or more of {{cssxref("border-block-width")}}, {{cssxref("border-block-style")}}, and {{cssxref("border-block-color")}} setting both the start and end in the block dimension at once. The physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the {{cssxref("border-top")}} and {{cssxref("border-bottom")}} or {{cssxref("border-right")}}, and {{cssxref("border-left")}} properties depending on the values defined for {{cssxref("writing-mode")}}, {{cssxref("direction")}}, and {{cssxref("text-orientation")}}.
The borders in the other dimension can be set with {{cssxref("border-inline")}}, which sets {{cssxref("border-inline-start")}}, and {{cssxref("border-inline-end")}}.
This property is a shorthand for the following CSS properties:
The border-block
is specified with one or more of the following, in any order:
<'border-width'>
<'border-style'>
<'color'>
{{CSSInfo}}
<div> <p class="exampleText">Example text</p> </div>
div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-rl; border-block: 5px dashed blue; }
{{EmbedLiveSample("Border_with_vertical_text", 140, 140)}}
Specification | Status | Comment |
---|---|---|
{{SpecName("CSS Logical Properties", "#propdef-border-block", "border-block")}} | {{Spec2("CSS Logical Properties")}} | 初始定义 |
{{Compat("css.properties.border-block")}}