div {
padding-top: 50px;
padding-right: 30px;
padding-bottom: 50px;
padding-left: 80px;
}
/* You can also write above code in one line */
div{
padding: 50px 30px 50px 80px; /* top right bottom left; (moving clockwise) */
}
padding: 5px 10px 15px 20px; //top right bottom left
padding: 10px 20px;//top & bottom then left & right
padding-top: 5px; //just top padding
padding-right: 10px; //just right padding
padding-bottom: 15px; //just bottom padding
padding-left: 20px; //just left padding
padding:10px 5px 15px 20px;
means
top padding is 10px
right padding is 5px
bottom padding is 15px
left padding is 20px
Padding is the defined space around an element
/* Here is how it works */
padding: 10px; /* for all sides i.e. top, bottom, right, left */
padding: 10px 5px; /* top & bottom , right & left */
padding: 10px 5px 15px; /* top, right & left, bottom */
padding: 10px 5px 15px 20px; /* top, right, bottom, left */(clockwide-rotation)
/* Each side can be defined individually */
padding-top: 10px;
padding-right: 5px;
padding-bottom: 15px;
padding-left: 20px;
/* Apply to all four sides */
padding: 1em;
/* vertical | horizontal */
padding: 5% 10%;
/* top | horizontal | bottom */
padding: 1em 2em 2em;
/* top | right | bottom | left */
padding: 5px 1em 0 2em;
/* Global values */
padding: inherit;
padding: initial;
padding: revert;
padding: revert-layer;
padding: unset;
padding: top, right, bottom, and left
.box {
padding: <padding-top> || <padding-right> || <padding-bottom> || <padding-left>
}
padding: 00px 00px 0px 0px; //top right bottom left
// mnemonic to remeber positions Te-Rri-B-Le (terrible)
padding: 1%; // scales proportionally - on ALL sides
padding: 5px 10px 15px; //top then left & right then bottom
An element's padding area is the space between its content and its border. Note: Padding creates extra space within an element. In contrast, margin creates extra space around an element.
padding is clockwise
h4 {
background-color: green;
padding: 10px;
}
h3 {
background-color: blue;
padding: 10px 5%;
}
padding: 15px 10px 20px;
Top padding is 15px
right and left padding are 10px
bottom padding is 20px
Code Example |
---|
Css :: hex color code for tan |
Css :: sass installation |
Css :: remove background from image |
Css :: z-index |
Css :: css active |
Css :: :not(:hover) |
Css :: angular css animation |
Css :: css when i add a border radius to input problem |
Css :: flex items not taking full width |
Css :: opposite of visibility hidden in css |
Css :: repeating gradient |
Css :: box sizing border box |
Css :: animated progress bar css |
Css :: css shape-outside |
Css :: css basic template |
Css :: how to saturate colors in css |
Css :: css height property |
Css :: css display |
Css :: gradient css |
Css :: css 16 9 ratio |
Css :: css symbol |
Css :: photo dropdown html |
Css :: How to replace broken image CSS? |
Css :: Install Golang On Linux (Ubuntu) |
Css :: django validation error css |
Css :: values play state animation css |
Css :: style checkmark css |
Css :: how to use tailwind css in react js |
Css :: material form css |
Css :: how to use variables in css |