{"id":350928,"date":"2021-09-02T07:42:25","date_gmt":"2021-09-02T14:42:25","guid":{"rendered":"https:\/\/css-tricks.com\/?page_id=350928"},"modified":"2021-09-17T08:40:03","modified_gmt":"2021-09-17T15:40:03","slug":"border-block","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/b\/border-block\/","title":{"rendered":"border-block"},"content":{"rendered":"\n

border-block<\/code> is a CSS logical<\/a> shorthand property that combines border-block-color<\/code>, border-block-style<\/code>, and border-block-width<\/code> into a single declaration.<\/p>\n\n\n\n

.element {\n  border-block: 5px solid red;\n  writing-mode: horizontal-tb;\n}<\/code><\/pre>\n\n\n\n

border-block<\/code> is the logical equivalent to physical properties including border-top<\/code> and border-bottom<\/code> (or border-right<\/code> and border-left<\/code>, depending on the writing-mode<\/a><\/code>). It is defined in the CSS Logical Properties and Values Level 1 specification<\/a> which is in Editor\u2019s Draft at the time of this writing. The property is also the companion to border-inline<\/a><\/code>, which styles borders that flow in the inline direction.<\/p>\n\n\n\n

\"Two
border-block<\/code> styles the borders in the block direction, top and bottom, of an element by default, but it adapts to borders in the inline direction, left and right, when switching the writing-mode<\/code>.<\/figcaption><\/figure>\n\n\n\n

The writing-mode<\/code> defaults to horizontal top-to-bottom if it is not explicitly declared.<\/p>\n\n\n

The writing mode sets the direction<\/h3>\n\n\n

The direction of the borders depends on the writing-mode<\/code> property. When the writing mode is set to the default horizontal direction, border-block<\/code> is applied to the top and bottom borders of an element. Conversely, a vertical writing-mode<\/code>, applies border-block<\/code> to the right and left borders.<\/p>\n\n\n\n