AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
HTML Tutorial

CSS Padding, top, bottom, left, right

The CSS padding properties are used to generate space around an element's content, inside of any defined borders as top, bottom, left, right. With CSS, you have full control and give any value over the padding. There are properties for setting the padding for each side of an element (top, right, bottom, and left).

Padding - Individual Sides as top, right, bottom, left

CSS has properties for specifying the padding for each side of an element top, right, bottom, left:

All the padding properties can have the next values:


Note: Negative values are not allowed for CSS pading top, right, bottom, left

If the padding property has this four values:
padding: 12px 15px 12px 16px;
top padding is 12px
right padding is 15px
bottom padding is 12px
left padding is 16px

Example:
div-box { padding: 12px 15px 12px 16px; }

CSS Padding - Shorthand Property

To shorten the code, it is possible to specify all the padding properties in one property.
The css padding property is a shorthand property for the following individual padding properties:
padding-top is 12px
padding-right is 15px
padding-bottom 12px
padding-left 16px

Example:
div-box { padding: 12px 15px 12px 16px; }
If the padding property has three values:
padding: 12px 15px 14px;
top padding is 12px
right and left paddings are 15px
bottom padding is 14px

Example:
div-box { padding: 12px 15px 14px; }
If the padding property has two values:
padding: 15px 20px;
top and bottom paddings are 15px
right and left paddings are 20px

Example:
div-box { padding: 15px 20px; }
If the padding property has one value:
padding: 16px;
all four paddings are 16px

Example:
div-box { padding: 16px; }

CSS Padding and Element Width

The CSS width property specifies the width of the element's content area. So, if an element has a specified width, the padding added to that element will be added to the total width of the element.
In the following example, the <div-box> element is given a width of 450px. However, the actual rendered width of the <div-box> element will be 450px (450px + 12px of left padding + 12px of right padding):

Example:
div-box {
width: 450px;
padding: 12px;
}
To keep the width at 450px, no matter the amount of padding, you can use the box-sizing property as.

Example:
div-box {
width: 450px;
padding: 12px;
box-sizing: border-box;
}

CSS Padding, top, bottom, left, right, color, css padding vs margin, css pading inside, css padding order CSS Padding, top, bottom, left, right - css tutorial

CSS Padding, top, bottom, left, right, color, css padding vs margin, css pading inside, css padding order
CSS Padding, top, bottom, left, right - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.