All Packages Class Hierarchy This Package Previous Next Index
Class org.w3c.css.properties.CssMargin
java.lang.Object
|
+----org.w3c.css.properties.CssProperty
|
+----org.w3c.css.properties.CssMargin
- public class CssMargin
- extends CssProperty
- implements CssOperator
'margin'
Value: [ <length> | <percentage> | auto ]{1,4}
Initial: not defined for shorthand properties
Applies to: all elements
Inherited: no
Percentage values: refer to parent element's width
The 'margin' property is a shorthand property for setting 'margin-top',
'margin-right' 'margin-bottom' and 'margin-left' at the same place in the
style sheet.
If four length 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.
BODY { margin: 2em } / * all margins set to 2em * /
BODY { margin: 1em 2em } / * top & bottom = 1em, right & left = 2em * /
BODY { margin: 1em 2em 3em } / * top=1em, right=2em, bottom=3em, left=2em * /
The last rule of the example above is equivalent to the example below:
BODY {
margin-top: 1em;
margin-right: 2em;
margin-bottom: 3em;
margin-left: 2em; / * copied from opposite side (right) * /
}
Negative margin values are allowed, but there may be implementation-specific
limits.
-
CssMargin()
- Create a new CssMargin
-
CssMargin(CssExpression)
- Create a new CssMargin
-
addToStyle(CssStyle)
- Add this property to the CssStyle
-
equals(CssProperty)
- Compares two properties for equality.
-
get()
- Returns the value of this property
-
getBottom()
- Returns the bottom property
-
getImportant()
- Returns true if this property is important.
-
getLeft()
- Returns the left property
-
getPropertyInStyle(CssStyle, boolean)
- Get this property in the style.
-
getPropertyName()
- Returns the name of this property
-
getRight()
- Returns the right property
-
getTop()
- Returns the top property
-
print(CssPrinterStyle)
- Print this property.
-
setImportant()
- Set this property to be important.
-
setInfo(int, String)
- Update the source file and the line.
-
setSelectors(CssSelectors)
- Set the context.
-
toString()
- Returns a string representation of the object.
CssMargin
public CssMargin()
- Create a new CssMargin
CssMargin
public CssMargin(CssExpression expression) throws InvalidParamException
- Create a new CssMargin
- Parameters:
- expression - The expression for this property
- Throws: InvalidParamException
- Values are incorrect
get
public Object get()
- Returns the value of this property
- Overrides:
- get in class CssProperty
getTop
public CssMarginTop getTop()
- Returns the top property
getRight
public CssMarginRight getRight()
- Returns the right property
getBottom
public CssMarginBottom getBottom()
- Returns the bottom property
getLeft
public CssMarginLeft getLeft()
- Returns the left property
getPropertyName
public String getPropertyName()
- Returns the name of this property
- Overrides:
- getPropertyName in class CssProperty
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class CssProperty
setImportant
public void setImportant()
- Set this property to be important.
Overrides this method for a macro
- Overrides:
- setImportant in class CssProperty
getImportant
public boolean getImportant()
- Returns true if this property is important.
Overrides this method for a macro
- Overrides:
- getImportant in class CssProperty
print
public void print(CssPrinterStyle printer)
- Print this property.
- Overrides:
- print in class CssProperty
- See Also:
- toString, getPropertyName
setSelectors
public void setSelectors(CssSelectors selector)
- Set the context.
Overrides this method for a macro
- Overrides:
- setSelectors in class CssProperty
- See Also:
- order, handleRule
addToStyle
public void addToStyle(CssStyle style)
- Add this property to the CssStyle
- Parameters:
- style - The CssStyle
- Overrides:
- addToStyle in class CssProperty
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
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
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