PEAR logo

HTML_CSS : The Definitive Guide

To Inline

HTML_CSS::toInline() allow to integrate html tags with styles.

[Warning] Warning
Dissociate html code and presentation layout (CSS) is more than recommanded

Here is a basic example that show a white 'Hello World' on a black background :

  1. <?php
  2. require_once 'HTML/CSS.php';
  3.  
  4. $css = new HTML_CSS();
  5.  
  6. $css->setStyle('body', 'background-color', '#0c0c0c');
  7. $css->setStyle('body', 'color', '#ffffff');
  8.  
  9. echo '<body style="' . $css->toInline('body') . '">';
  10. echo '<p>Hello World</p>';
  11. echo '</body>';
  12. ?>
HTML_CSS : The Definitive Guide v 1.5.0 : January 15, 2008