CSS in Body

yigal 29 Sep, 2009
How can I link the code in the body to a css file?
That means, I want to put somthing like
<td class="tabledesign">
in the body. and then define the tabledesign in a css file.
GreyHead 29 Sep, 2009
Hi yigal,

Just like that. If you need to add css snippets or a link to load a css file you can do it in the header box. Here's the general purpose code that I use :
>?php
$styles = array();
$style = "";
. . .
$style .= "/* some css */";
. . .
$styles[] = "url_of_stylesheet";
. . .
// at end of document
$doc =& JFactory::getDocument();
if ( count($styles) ) {
  foreach ( $styles as $v ) {
    $doc->addStyleSheet($v);
  }
}
if ( $style ) {
  $doc->addStyleDeclaration($style);
}
?>

Bob
This topic is locked and no more replies can be posted.