The Css factory provides standard objects which represent the individual elements of the Cascading Style Sheets standard.
To use the Css factory in a View include it in the $factories property of the CTK class, for example:
public $factories = array('Ctk.Css');
Once the factory is available you can access the objects it provides. To call an object from the factory simply call the factory, and then the desired object, for example:
$this->Css->Rule(array(
'selector' => '#ID div.class'
));
As shown in the example, an array can be passed to the object with parameters to configure the object's template.
The objects available in the Css factory are the following:
- Block - Base object for all CSS elements.
- Declaration - Object representating the CSS selector.
- Fontface - Object representing the @font-face declaration.
- Media - Object representing the @media declaration.
- Rule - Object representing a single property and value.
The Css factory provides a layout specific for CSS, which can be set from the $layout property of the CTK class, for example:
public $layout = 'Ctk.Css/default';