border-image-outset - CSS: Cascading Style Sheets 编辑

The border-image-outset CSS property sets the distance by which an element's border image is set out from its border box.

The parts of the border image that are rendered outside the element's border box with border-image-outset do not trigger overflow scrollbars and don't capture mouse events.

Syntax

/* <length> value */
border-image-outset: 1rem;

/* <number> value */
border-image-outset: 1.5;

/* vertical | horizontal */
border-image-outset: 1 1.2;

/* top | horizontal | bottom */
border-image-outset: 30px 2 45px;

/* top | right | bottom | left */
border-image-outset: 7px 12px 14px 5px;

/* Global values */
border-image-outset: inherit;
border-image-outset: initial;
border-image-outset: unset;

The border-image-outset property may be specified as one, two, three, or four values. Each value is a <length> or <number>. Negative values are invalid and will cause the border-image-outset declaration to be ignored.

  1. If one value is specified, it applies to all four sides.
  2. If two values are specified, the first applies to the top and bottom and the second to the left and right.
  3. If three values are specified, the first applies to the top, the second to the left and right, and the third to the bottom.
  4. If four values are specified, they apply to the top, right, bottom, and left in that order (clockwise).

Values

<length>
The size of the border-image outset as a dimension — a number with a unit.
<number>
The size of the border-image outset as a multiple of the element's corresponding border-widths. For example, if an element has border-width: 1em 2px 0 1.5rem, and border-image-outset: 2, the final border-image-outset would be calculated as 2em 4px 0 3rem.

Formal definition

Initial value0
Applies toall elements, except internal table elements when border-collapse is collapse. It also applies to ::first-letter.
Inheritedno
Computed valueas specified, but with relative lengths converted into absolute lengths
Animation typeby computed value type

Formal syntax

[ <length> | <number> ]{1,4}

Examples

Outsetting a border image

HTML

<div id="outset">This element has an outset border image!</div>

CSS

#outset {
  width: 10rem;
  background: #cef;
  border: 1.4rem solid;
  border-image: radial-gradient(#ff2, #55f) 40;
  border-image-outset: 1.5;  /* 1.5 × 1.4rem = 2.1rem */
  margin: 2.1rem;
}

Result

Specifications

SpecificationStatusComment
CSS Backgrounds and Borders Module Level 3
The definition of 'border-image-outset' in that specification.
Candidate RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:103 次

字数:7889

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文