what is css padding

青灯夜游
Release: 2021-07-05 16:05:25
Original
5102 people have browsed it

css padding refers to the blank area between the element border and the element content. Controlling this area are the padding, padding-top, padding-right, padding-bottom, and padding-left properties; they accept length or percentage values, but do not allow negative values.

what is css padding

The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.

CSS padding is the padding of an element, which refers to the blank area between the element border and the element content.

what is css padding

With CSS, you have complete control over padding (padding). There are properties that set padding for each side of the element (top, right, bottom, and left).

CSS has properties for specifying padding on each side of an element:

  • padding-top

  • padding-right

  • padding-bottom

  • padding-left

You can also use padding directly and specify all the above padding attributes in one attribute. Reduce code.

The padding attribute accepts a length value or a percentage value, but negative values ​​are not allowed.

Possible values:

Value Description
auto The browser calculates the padding.
length Specifies the padding value in specific units, such as pixels, centimeters, etc. The default value is 0px.
% Specifies padding as a percentage of the width of the parent element.
inherit Specifies that padding should be inherited from the parent element.

The padding attribute can have 1~4 values:

padding:25px 50px 75px 100px;
Copy after login
  • The top padding is 25px

  • The right padding is 50px

  • The bottom padding is 75px

  • The left padding is 100px

padding:25px 50px 75px;
Copy after login
  • The top padding is 25px

  • The left and right padding is 50px

  • The bottom padding is 50px 75px

padding:25px 50px;
Copy after login
  • The top and bottom padding is 25px

  • The left and right padding is 50px

padding:25px;
Copy after login
  • All padding is 25px

(Learning video sharing: css video tutorial)

The above is the detailed content of what is css padding. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!