From Joomla! Documentation

Revision as of 11:14, 10 November 2008 by Chris Davenport (Talk | contribs)

Adds the definition of a linked external stylesheet to the document. Duplicates are ignored.


void addStyleSheet( $url, $type, $media, $attribs )


Argument Data type Description Default
$url string URL of stylesheet.
$type string MIME type of script. 'text/css'
$media string Media type that the stylesheet applies to. null
$attribs array Array of attributes.


To add a link to some style sheet at a specific URL, you could use:

$doc =& JFactory::getDocument();
$doc->addStyleSheet( “” );

How this is rendered depends on the document type. If the document type is HTML then this code will produce following link in the HTML HEAD section:

<link rel="stylesheet" href="" type="text/css" />

See also