PEAR logo

HTML_CSS : The Definitive Guide

Create group

Identify the group yourself
Let HTML_CSS do it itself

HTML_CSS::createGroup() creates basically a group for selectors given as first argument. You can identify this group by an identifier (alphanumeric) or let HTML_CSS manage an internal numeric identifier itself.

Let creates this group of selectors :

#main p, #main ul { padding-top: 1em; color: red; }
     

Identify the group yourself

Identifier is named myGroupID in this example:

      
<?php
require_once 'HTML/CSS.php';

$css = new HTML_CSS();

$g1 = $css->createGroup('#main p, #main ul', 'myGroupID');
$css->setGroupStyle($g1, 'padding-top', '1em');
$css->setGroupStyle($g1, 'color', 'red');

$css->display();
?>
      
     

Let HTML_CSS do it itself

[Note] Note
This is the default behavior.

      
<?php
require_once 'HTML/CSS.php';

$css = new HTML_CSS();

$g1 = $css->createGroup('#main p, #main ul');
$css->setGroupStyle($g1, 'padding-top', '1em');
$css->setGroupStyle($g1, 'color', 'red');

$css->display();
?>
      
     

HTML_CSS : The Definitive Guide v 1.0.0 : June 24, 2006