CSS GUIDE PADDING RIGHT

From CDOT Wiki
Jump to: navigation, search

This document is a work in progress and is subject to change.

Summary

The padding-right elements specifies the padding between an element and a direct sibling of it. Unlike margin, padding is outside of the contents. For example, if you have a <div> with a solid border the padding will be outside of the border.

Applicability:The padding-right property can be used for all CSS elements.
Media Group: Visual
Inherited:No

Syntax

TARGET_ELEMENT{padding-right: 5px}
TARGET_ELEMENT{padding-right: 3em}

Legal Values

The following units are valid for defining padding: cm (centimeters), em (ems), in (inches), mm (millimeters), pc (picas), px (pixels), pt (points), % (percentage of enclosing block level element).

Percentages and ems are the preferred units as they are relative.

See usage examples section for more details.

Mozilla Recommended Values

Usage Examples

p{padding-right: 25%;}  /*Set the right padding to 25% of the enclosing element*/
h1{padding-right: 50px;}  /*Set the right padding to 50 pixels*/
span{padding-right: 2in;}  /*Set the right padding to 2 inches*/

Notes

The World Wide Web Consortium (W3C) provides a free online CSS validation service.

Specification Conformance

Browser Compatibility

  • Internet Explorer
  • Firefox
  • Opera

See Also