mixed|PEAR_Error HTML_CSS::createGroup (
string $selectors
, mixed $group
= null
)
Create a new CSS definition group. Return an integer identifying the group.
$selectors
Selector(s) to be defined, comma delimited.
$group
(optional) Group identifier. If not passed, will return an automatically assigned integer.
throws HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_INVALID_GROUP
since version 0.3.0 (2003-11-03)
This function can not be called statically.
<?php
require_once 'HTML/CSS.php';
$css = new HTML_CSS();
// define styles
$css->setStyle('p', 'text-align', 'center');
$css->setStyle('p', 'color', '#ffffff');
$css->setStyle('p', 'text-align', 'left');
$css->setStyle('p', 'font', '16pt helvetica, arial, sans-serif');
$css->setStyle('p', 'font', '12pt helvetica, arial, sans-serif');
// create a selectors group
$groupID = 'myGroup';
$groupID = $css->createGroup('p, a', $groupID);
// define styles of this new group
$css->setGroupStyle($groupID, 'font', '12pt helvetica, arial, sans-serif');
// display result
echo $css->toString();
// will output:
/*
p, a {
font: 12pt helvetica, arial, sans-serif;
}
p {
text-align: left;
color: #ffffff;
font: 12pt helvetica, arial, sans-serif;
}
*/
?>