XtGem Forum catalog

p _ x
Bookmark Weezywap
JarApkBmkOpera
(GMT+1)
Tuesday April 23rd 2024
+
Always Post weezywap.xtgem.com on your facebook, twitter, 2go, whatsapp and instagram status! If you love WEEZYWAP and enjoy unlimited services here!
»Css Basics
You are viewing Chapter 8 of 18 Chapters for Css Basics/Tutorials. View all Chapters
Chapter 1: Introduction to CSS
Chapter 2: CSS Syntax
Chapter 3: CSS Classes
Chapter 4: CSS IDs
Chapter 5: CSS Divisions
Chapter 6: CSS Spans
Chapter 7: CSS Margins
Chapter 8: CSS Padding
Chapter 9: CSS Text Properties
Chapter 10: CSS Font Properties
Chapter 11: CSS Anchors, Links and Pseudo Classes
Chapter 12: CSS Backgrounds
Chapter 13: CSS Borders
Chapter 14: CSS Ordered & Unordered Lists
Chapter 15: CSS Width and Height Properties
Chapter 16: CSS Classification
Chapter 17: CSS Positioning
Chapter 18: CSS Pseudo Elements
Chapter 8: CSS Padding

Inherited: No
Padding is the distance between the border of an (X)HTML element and the content within it.
Most of the rules for margins also apply to padding, except there is no "auto" value, and negative values cannot be declared for padding.

padding-top: length percentage;
padding-left: length percentage;
padding-right: length percentage;
padding-bottom: length percentage;


As you can also see in the above example you have 2 choices of values for the padding property

length
percentage

You can also declare all the padding of an element in a single property as follows:
padding: 10px 10px 10px 10px;

If you declare all 4 values as I have above, the order is as follows:
1. top
2. right
3. bottom
4. left

If only one value is declared, it sets the padding on all sides. (see below)

padding: 10px;

If you only declare two or three values, the undeclared values are taken from the opposing side. (see below)

padding: 10px 10px; /* 2 values */
padding: 10px 10px 10px; /* 3 values */


If you do not declare the padding value of an element, the padding is 0 (zero).
Note: You do not have to add px (pixels) or whatever units you use, if the value is 0 (zero).
You can see in the example below, the main container for this site has 30px (pixels) of padding between the border and the text.

#container{
width: 70%;
margin: auto;
padding: 30px;
border: 1px solid #666;
background: #ffffff;
}


« PreviousJump to Chapter:
Next »

Translate
Pages
Copyright © 2024 WEEZYWAP
facebook twitter whatsapp google plus
Home | About Us | Advertise | Frequently Asked Question | Contact Us | Partners | Disclaimer | Terms of Services | Invite Friends | Credits



Online: 1 , Today: 1, Hits: 32798
Last modified: 19-01-2017 9:11:03 pm