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 :

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

Identify the group yourself

Identifier is named myGroupID in this example:

  1. <?php
  2. require_once 'HTML/CSS.php';
  3.  
  4. $css = new HTML_CSS();
  5.  
  6. $g1 = $css->createGroup('#main p, #main ul', 'myGroupID');
  7. $css->setGroupStyle($g1, 'padding-top', '1em');
  8. $css->setGroupStyle($g1, 'color', 'red');
  9.  
  10. $css->display();
  11. ?>

Let HTML_CSS do it itself

[Note] Note
This is the default behavior.
  1. <?php
  2. require_once 'HTML/CSS.php';
  3.  
  4. $css = new HTML_CSS();
  5.  
  6. $g1 = $css->createGroup('#main p, #main ul');
  7. $css->setGroupStyle($g1, 'padding-top', '1em');
  8. $css->setGroupStyle($g1, 'color', 'red');
  9.  
  10. $css->display();
  11. ?>
HTML_CSS : The Definitive Guide v 1.5.0 : January 15, 2008