HTML_CSS::addGroupSelector
HTML_CSS::addGroupSelector() – Add a selector to a CSS definition group.
Synopsis
require_once 'HTML/CSS.php';
void|PEAR_Error HTML_CSS::addGroupSelector (
mixed $group
, string $selectors
)
Description
Add a selector to a CSS definition group
Parameter
-
mixed
$group
-
CSS definition group identifier
-
string
$selectors
-
Selector(s) to be defined, comma delimited.
Throws
throws HTML_CSS_ERROR_NO_GROUP, HTML_CSS_ERROR_INVALID_INPUT
Since
since version 0.3.0 (2003-11-03)
Note
This function can not be called statically.
Example
<?php
require_once 'HTML/CSS.php';
$css = new HTML_CSS();
// define styles
$g = $css->createGroup('body, html');
$css->setGroupStyle($g, 'margin', '2px');
$css->setGroupStyle($g, 'padding', '0');
$css->setGroupStyle($g, 'border', '0');
// display intermediate result
echo $css->toString();
// will output:
/*
body, html {
margin: 2px;
padding: 0;
border: 0;
}
*/
// did not reflect a real usage, it's only a study case purpose
$css->removeGroupSelector($g, 'body');
$css->addGroupSelector($g, '.large');
$css->setGroupStyle($g, 'border', 'solid thin');
// display final result
echo $css->toString();
// will output:
/*
html, .large {
margin: 2px;
padding: 0;
border: solid thin;
}*/
?>