Enum Class Position

java.lang.Object
java.lang.Enum<Position>
com.oorian.css.Position
All Implemented Interfaces:
Serializable, Comparable<Position>, Constable

public enum Position extends Enum<Position>
CSS position property values for element positioning method.

The position property specifies how an element is positioned in the document. Once positioned, the element can be adjusted using top, right, bottom, and left properties.

Position Types:

  • STATIC - Normal document flow (default)
  • RELATIVE - Offset from normal position
  • ABSOLUTE - Positioned relative to nearest positioned ancestor
  • FIXED - Positioned relative to viewport
  • STICKY - Hybrid of relative and fixed

Usage:


 element.setPosition(Position.RELATIVE);
 element.setPosition(Position.ABSOLUTE);
 element.setPosition(Position.STICKY);
 
Since:
2012
Version:
1.1
Author:
Marvin P. Warble Jr.
See Also:
  • BasicBoxIntf
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Positioned relative to the nearest positioned ancestor.
    Positioned relative to the viewport.
    Inherits the position value from the parent element.
    Sets the position to the default value (static).
    Positioned relative to its normal position.
    Rolls back to the value defined by a previous cascade origin.
    Rolls back to the value defined in the previous cascade layer.
    Normal document flow positioning (default).
    Hybrid of relative and fixed positioning.
    Resets the property to its inherited value or initial value.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the CSS value string.
    Returns the CSS value string.
    static Position
    Returns the enum constant of this class with the specified name.
    static Position[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • INHERIT

      public static final Position INHERIT
      Inherits the position value from the parent element.
    • INITIAL

      public static final Position INITIAL
      Sets the position to the default value (static).
    • UNSET

      public static final Position UNSET
      Resets the property to its inherited value or initial value.
    • REVERT

      public static final Position REVERT
      Rolls back to the value defined by a previous cascade origin.
    • REVERT_LAYER

      public static final Position REVERT_LAYER
      Rolls back to the value defined in the previous cascade layer.
    • STATIC

      public static final Position STATIC
      Normal document flow positioning (default). The element is positioned according to the normal flow. Top, right, bottom, left, and z-index have no effect.
    • RELATIVE

      public static final Position RELATIVE
      Positioned relative to its normal position. The element remains in normal flow, but can be offset using top, right, bottom, and left. Other elements are not affected.
    • ABSOLUTE

      public static final Position ABSOLUTE
      Positioned relative to the nearest positioned ancestor. The element is removed from normal flow. If no positioned ancestor exists, it is positioned relative to the initial containing block.
    • FIXED

      public static final Position FIXED
      Positioned relative to the viewport. The element is removed from normal flow and stays in place when the page is scrolled. Useful for persistent headers or footers.
    • STICKY

      public static final Position STICKY
      Hybrid of relative and fixed positioning. The element is treated as relative until it crosses a specified threshold (using top, right, bottom, or left), then it becomes fixed. Commonly used for sticky navigation headers.
  • Method Details

    • values

      public static Position[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Position valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getValue

      public String getValue()
      Returns the CSS value string.
      Returns:
      the CSS value
    • toString

      public String toString()
      Returns the CSS value string.
      Overrides:
      toString in class Enum<Position>
      Returns:
      the CSS value