Home>Article>Web Front-end> How to use css padding-top attribute

How to use css padding-top attribute

silencement
silencement Original
2019-05-26 15:15:33 3301browse

How to use css padding-top attribute

padding-top attribute definition and usage

In css, the padding-top attribute is used to set the top padding (top padding ). If you need to set the top, right, bottom, and left margins at the same time, you can use the padding attribute. The padding attribute can define the top, right, bottom, and left margins in one statement.

padding-top similar attributes

padding-right attribute: right padding

padding-left attribute: left padding

padding-bottom attribute: bottom padding

padding-top attribute syntax format

css syntax: padding-top:length/%/inherit

JavaScript syntax: object.style.paddingTop="2cm"

Attribute value description

length: Specifies the fixed lower padding value in specific units , such as pixels, centimeters, etc. The default value is 0px

%: Defines the bottom padding as a percentage based on the width of the parent element. This value will not work as expected in all browsers

inherit: From the parent element Inherit the value of the padding-top attribute

Instance

How to use css padding-top attribute

The above is the detailed content of How to use css padding-top attribute. 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