Рекурсивный акроним словосочетания «PHP: Hypertext Preprocessor»
Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 17510 программистов и 1874 робота. Сейчас ищут 1754 программиста ...
HTML_CSS::createGroup
Вернуться к: Grouping selectors
HTML_CSS::createGroup
HTML_CSS::createGroup() – Create a new CSS definition group
Synopsis
require_once 'HTML/CSS.php';
mixed|PEAR_Error HTML_CSS::createGroup ( string $selectors , mixed $group = null )
Create a new CSS definition group. Return an integer identifying the group.
Parameter
- string $selectors
-
Selector(s) to be defined, comma delimited.
- mixed $group
-
(optional) Group identifier. If not passed, will return an automatically assigned integer.
See
Throws
throws HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_INVALID_GROUP
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
$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;
}
*/
?>
Вернуться к: Grouping selectors