Difference between revisions of "JDocument/addStyleSheet"

From Joomla! Documentation

(Replaced JS function: MIME, example section + added real example)
m (Fixed bizarre double quotes)
Line 34: Line 34:
<source lang="php">
<source lang="php">
$doc =& JFactory::getDocument();
$doc =& JFactory::getDocument();
$doc->addStyleSheet( “” );

Revision as of 11:02, 10 November 2008

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();

Example code will produce following link:

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

See also