Margins create space between the edge of an element and the edge of any adjacent elements. Padding creates the space between the edge of the element and its content. The margin and padding shorthand properties also can be used to make CSS code more concise.
The margin property can combine margine-top, margin-right, margin-bottom, and margin-left. The padding property can combine padding-top, padding-right, padding-bottom, and padding-left.
The margin and padding properties also can be used to style different values for each side of an element. Values are applied in the follow order: top, right, bottom, and left – clockwise starting at the top.
The <p> element can be styled with padding-top, padding-right, padding-bottom, and padding-left or with a single padding property.
CSS Longhand
color: maroon;
font: 80% arial, helvetica, sans-serif;
padding-top: 1em;
padding-right: 2em;
padding-bottom: 3em;
padding-left: 4em;
}
CSS ShortHand
color: maroon;
font: 80% arial, helvetica, sans-serif;
padding: 1em 2em 3em 4em;
}
Helpful Articles
Diabetic Renal Diet for CKD Patients Diet
Diabetic Renal Diet Guidelines Made Easy! Being that one of the most common extrarenal diseases affecting the kidney is diabetes mellitus, diabetic renal diet has become a topic of interest nowadays...
The Lemonade Diet
There are many people who have the primary goal of weight loss and they turn to the lemonade diet to lose weight quickly...
How Nutrition Affects Your Dog’s Behavior
A very important aspect in owning and taking care of a pet dog is providing the animal with good nutrition and proper nourishment...