All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.css.properties.CssPadding

java.lang.Object
   |
   +----org.w3c.css.properties.CssProperty
           |
           +----org.w3c.css.properties.CssPadding

public class CssPadding
extends CssProperty
implements CssOperator

   'padding'

Value: [ <length> | <percentage> ]{1,4}
Initial: 0
Applies to: all elements
Inherited: no
Percentage values: refer to parent element's width

The 'padding' property is a shorthand property for setting 'padding-top', 'padding-right' 'padding-bottom' and 'padding-left' at the same place in the style sheet.

If four values are specified they apply to top, right, bottom and left respectively. If there is only one value, it applies to all sides, if there are two or three, the missing values are taken from the opposite side.

The surface of the padding area is set with the 'background' property:

   H1 { 
     background: white; 
     padding: 1em 2em;
   } 
 

The example above sets a '1em' padding vertically ('padding-top' and 'padding-bottom') and a '2em' padding horizontally ('padding-right' and 'padding-left'). The 'em' unit is relative to the element's font size: '1em' is equal to the size of the font in use.

Padding values cannot be negative.


Constructor Index

 o CssPadding()
Create a new CssPadding
 o CssPadding(CssExpression)
Create a new CssPadding

Method Index

 o addToStyle(CssStyle)
Add this property to the CssStyle
 o equals(CssProperty)
Compares two properties for equality.
 o get()
Returns the value of this property
 o getBottom()
Returns the bottom property
 o getImportant()
Returns true if this property is important.
 o getLeft()
Returns the left property
 o getPropertyInStyle(CssStyle, boolean)
Get this property in the style.
 o getPropertyName()
Returns the name of this property
 o getRight()
Returns the right property
 o getTop()
Returns the top property
 o print(CssPrinterStyle)
Print this property.
 o setImportant()
Set this property to be important.
 o setInfo(int, String)
Update the source file and the line.
 o setSelectors(CssSelectors)
Set the context.
 o toString()
Returns a string representation of the object.

Constructors

 o CssPadding
 public CssPadding()
Create a new CssPadding

 o CssPadding
 public CssPadding(CssExpression expression) throws InvalidParamException
Create a new CssPadding

Parameters:
expression - The expression for this property
Throws: InvalidParamException
Values are incorrect

Methods

 o get
 public Object get()
Returns the value of this property

Overrides:
get in class CssProperty
 o getTop
 public CssPaddingTop getTop()
Returns the top property

 o getRight
 public CssPaddingRight getRight()
Returns the right property

 o getBottom
 public CssPaddingBottom getBottom()
Returns the bottom property

 o getLeft
 public CssPaddingLeft getLeft()
Returns the left property

 o getPropertyName
 public String getPropertyName()
Returns the name of this property

Overrides:
getPropertyName in class CssProperty
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class CssProperty
 o setImportant
 public void setImportant()
Set this property to be important. Overrides this method for a macro

Overrides:
setImportant in class CssProperty
 o getImportant
 public boolean getImportant()
Returns true if this property is important. Overrides this method for a macro

Overrides:
getImportant in class CssProperty
 o print
 public void print(CssPrinterStyle printer)
Print this property.

Overrides:
print in class CssProperty
See Also:
toString, getPropertyName
 o setSelectors
 public void setSelectors(CssSelectors selector)
Set the context. Overrides this method for a macro

Overrides:
setSelectors in class CssProperty
See Also:
order, handleRule
 o addToStyle
 public void addToStyle(CssStyle style)
Add this property to the CssStyle

Parameters:
style - The CssStyle
Overrides:
addToStyle in class CssProperty
 o getPropertyInStyle
 public CssProperty getPropertyInStyle(CssStyle style,
                                       boolean resolve)
Get this property in the style.

Parameters:
style - The style where the property is
resolve - if true, resolve the style to find this property
Overrides:
getPropertyInStyle in class CssProperty
 o setInfo
 public void setInfo(int line,
                     String source)
Update the source file and the line. Overrides this method for a macro

Parameters:
line - The line number where this property is defined
source - The source file where this property is defined
Overrides:
setInfo in class CssProperty
 o equals
 public boolean equals(CssProperty property)
Compares two properties for equality.

Parameters:
value - The other property.
Overrides:
equals in class CssProperty

All Packages  Class Hierarchy  This Package  Previous  Next  Index