All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.css.values.CssPercentage

java.lang.Object
   |
   +----org.w3c.css.values.CssValue
           |
           +----org.w3c.css.values.CssPercentage

public class CssPercentage
extends CssValue

   Percentage units

The format of a percentage value is an optional sign character ('+' or '-', with '+' being the default) immediately followed by a number (with or without a decimal point) immediately followed by '%'.

Percentage values are always relative to another value, for example a length unit. Each property that allows percentage units also defines what value the percentage value refer to. Most often this is the font size of the element itself:

   P { line-height: 120% }   / * 120% of the element's 'font-size' * /
 

In all inherited CSS1 properties, if the value is specified as a percentage, child elements inherit the resultant value, not the percentage value.


Constructor Index

 o CssPercentage()
Create a new CssPercentage
 o CssPercentage(float)
Create a new CssPercentage with a float
 o CssPercentage(Float)
Create a new CssPercentage with a Float value.
 o CssPercentage(int)
Create a new CssPercentage with a number

Method Index

 o equals(Object)
Compares two values for equality.
 o get()
Returns the current value
 o set(String, Frame)
Set the value of this percentage.
 o toString()
Returns a string representation of the object.

Constructors

 o CssPercentage
 public CssPercentage()
Create a new CssPercentage

 o CssPercentage
 public CssPercentage(int value)
Create a new CssPercentage with a number

Parameters:
value - The value.
 o CssPercentage
 public CssPercentage(float value)
Create a new CssPercentage with a float

Parameters:
value - the float value.
 o CssPercentage
 public CssPercentage(Float value)
Create a new CssPercentage with a Float value.

Parameters:
value - the Float object.

Methods

 o set
 public void set(String s,
                 Frame frame) throws InvalidParamException
Set the value of this percentage.

Parameters:
s - the string representation of the percentage.
frame - For errors and warnings reports.
Throws: InvalidParamException
The unit is incorrect
Overrides:
set in class CssValue
 o get
 public Object get()
Returns the current value

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

Overrides:
toString in class Object
 o equals
 public boolean equals(Object val)
Compares two values for equality.

Parameters:
value - The other value.
Overrides:
equals in class CssValue

All Packages  Class Hierarchy  This Package  Previous  Next  Index