css底部边框

tech2023-01-14  114

css底部边框

句法 (Syntax)

border-width ] [ border-width ] [ border-style ] [ border-style ] [ border-color ] | inherit } ; border-color ] | 继承};

描述 (Description)

The border-bottom shorthand property sets border-bottom-width and/or border-bottom-style and/or border-bottom-color to the bottom side of an element simultaneously.

border-bottom简写属性同时将border-bottom-width和/或border-bottom-style和/或border-bottom-color同时设置到元素的底部。

Borders are placed on top of the element’s background.

边框放置在元素背景的顶部。

(Example)

This style rule assigns a 2px blue border to the bottom side of paragraphs within the element with ID "example":

此样式规则为ID为"example"的元素内段落的底部分配2px的蓝色边框:

#example p { border-bottom: 2px solid blue; }

(Value)

Refer to the following individual properties for specific information on allowed and initial values: border-width, border-style, and border-color.

有关允许和初始值的特定信息,请参考以下各个属性: border-width , border-style和border-color 。

Negative length values are illegal.

负长度值是非法的。

As with most shorthand properties, you don’t need to specify all the properties listed, but any omitted properties will revert to their default values. In the case of border-style, if you omit a value no border will show at all, because the default value is none. A border will only be visible as long as the border-style property has been set to something other than none or hidden, or has been restated explicitly after the initial shorthand declaration. Otherwise, no border will show and the border-width will be reset to zero. Therefore, its good practice to specify a value for the border’s style when you’re using shorthand notation.

与大多数速记属性一样,您无需指定所有列出的属性,但是任何省略的属性都将恢复为其默认值。 在border-style的情况下,如果省略一个值,则根本不会显示任何边框,因为默认值为none 。 仅当border-style属性设置为none或hidden以外的其他值,或者在初始速记声明后已明确地重新设置边框时,边框才可见。 否则,将不会显示任何边框,并且border-width将重置为零。 因此,在使用速记符号时,最好为边框的样式指定一个值。

翻译自: https://www.sitepoint.com/border-bottom-css-property/

css底部边框

最新回复(0)