PEAR logo

HTML_CSS : The Definitive Guide

Parse a simple string

A quick way to create multiple selector definitions in one step is to use the HTML_CSS::parseString() function.

Let creates these definitions :

html, body {
  margin: 2px;
  padding: 0px;
  border: 0px;
}

p, body {
  margin: 4px;
}
     

Very easy with such script :

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

$css = new HTML_CSS();

$strcss = '
html, body {
  margin: 2px;
  padding: 0px;
  border: 0px;
}

p, body {
  margin: 4px;
}
';
$css->parseString($strcss);

$css->display();
?>
      
     

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