Home>Article>Web Front-end> How to use css border-top property

How to use css border-top property

silencement
silencement Original
2019-05-26 14:19:07 5831browse

How to use css border-top property

border-top attribute definition and usage

In css, the border-top attribute is a shorthand attribute, which is used to place elements above All properties of the border are defined in one statement. When we want to individually set the display effect of the border on the element, we can use the border-top attribute in CSS to achieve this.

The top border attributes defined by the border-top attribute: border-top-width (top border width), border-top-style (top border style), border-top-color (top border color).

border-top attribute syntax format

css syntax: border-top:border-top-width border-top-style border-top-color; (Example: border-top:1px solid red;)

JavaScript syntax: style.borderTop="border-top-width border-top-style border-top-color";( Example: style.borderTop="border-top:1px solid red;")

Explanation

The border-top attribute has an attribute value that is not set. For example: border-top: solid red; is also possible. However, if the top border style (border-top-style) has not been set before, the second parameter of the border-top attribute is also omitted, and the border-top attribute has no effect. That is to say, to set the display effect of the border, you must define the element border (the default element border is transparent). If you set the color or width of a transparent border, you will not see the display effect.

border-top attribute value description

border-top-width: Set the width of the top border

border-top-style Set the top border Style

border-top-color Set the color of the top border

inherit: Inherit the border-top attribute value from the parent element.

Example

    css border-top属性设置上边框的显示效果笔记  
border-top:1px solid red;
border-top:solid #FFCCCC;
border-top:5px solid;



The above is the detailed content of How to use css border-top property. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn