Loading Please Wait...

Logo Lynxsia IT Solutions

CSS Paddings

CSS Paddings

CSS padding property sets transparent white space within the element. It is a space between element border and content (text, image).

					 
        
          padding: 10px;
          padding: 5%;
          padding: unset;
        
      
Padding Values

CSS padding property can have following values:

Length values: px, cm, rem, em, etc.

Percentage values: 5%, 10%, etc.

Zero value: 0px, 0%, 0. It is best practice not to use any length or percentage value when defining 0 padding.

Global value: inherit, initial, revert, revert-layer, unset.

Syntax
One Value

Sets padding for all sides

padding: 10px;

Two Value

First value sets padding of top-bottom and second value sets padding of left-right

padding: 10px 0.5rem;

Three Value

First value sets padding of top, second value sets padding of left-right and third value sets padding of bottom

padding: 10px 0.5rem 5%;

Four Value

First value sets padding of top, second value sets padding of right, third value sets padding of bottom, and forth value sets padding of left.

padding: 10px 0.5rem 5% auto;

					 
        
          /* Apply to all four sides */
          padding : 1em;

          /* top and bottom | left and right */
          padding: 5% 10px;

          /* top | left and right | bottom */
          padding: 1em 20px 2em;

          /* top | right | bottom | left */
          padding: 2px 1em 0 20px;

          /* Global values */
          padding: inherit;
          padding: initial;
          padding: revert;
          padding: revert-layer;
          padding: unset;
        
      
Individual Sides

CSS provide padding-top, padding-right, padding-bottom, padding-left property to set padding of individual sides.

					 
        
          /* top padding */
          padding-top: 10px;

          /* right padding */
          padding-right: 0;

          /* bottom padding */
          padding-bottom: 5%;

          /* left padding */
          padding-left: inherit;
        
      
Key Points To Remember
Padding is used to extend the background of the element content.
There is no negative padding like negative margin.

How you feel about this blog:

Share this blog on:

Report Us

If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com

Contact Us
Ads
Logo
Lynxsia IT Solutions

We are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..

Kotwali Road, Chhiptehri, Banda, 210001, UP, India

Copyright © 2022, Lynxsia IT Solutions, All rights reserved