Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16689 программистов и 1770 роботов. Сейчас ищут 995 программистов ...
HTML_CSS::addGroupSelector
Вернуться к: Grouping selectors
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 )
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;
}*/
?>
Вернуться к: Grouping selectors