| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Document |
JDocument |
addStyleDeclaration |
addStyleDeclaration() |
Never | Work in Progress |
Adds a stylesheet declaration to the page.
void addStyleDeclaration ( $content, $type )
| $content | string | is a string containing the style declarations. |
| $type | string | is a string containing the type of style. This parameter is optional and if omitted defaults to ‘text/css’. |
This example adds a style declaration to the page.
Example
global $mainframe; $style = "body {" . "\n margin: 0px 0px 0px 0px;" . "\n height: 100%;" . "\n font-size: 76%;" . "\n}"; $document = &JFactory::getDocument(); $document->addStyleDeclaration( $style );
Might add the following code to the head block of the current page:
Result
<style type="text/css"> <!-- body { margin: 0px 0px 0px 0px; height: 100%; font-size: 76%; } --> </style>