HTML_CSS
[ class tree: HTML_CSS ] [ index: HTML_CSS ] [ all elements ]

Source for file CSS_Inline.php

Documentation is available at CSS_Inline.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997 - 2004 The PHP Group                              |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 3.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/3_0.txt.                                  |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Author:  Klaus Guenther <klaus@capitalfocus.org>                     |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: CSS_Inline.php,v 1.4 2004/01/14 22:21:16 thesaur Exp $
  20.  
  21.  
  22.  
  23. require_once 'HTML/CSS.php';
  24.  
  25. // generate a new class
  26. $css = new HTML_CSS();
  27.  
  28. // let's set some styles for <body>
  29. $css->setStyle('body''background-color''#0c0c0c');
  30. $css->setStyle('body''color''#ffffff');
  31.  
  32. // now for <h1>
  33. $css->setStyle('h1''text-align''center');
  34. $css->setStyle('h1''font''16pt helvetica, arial, sans-serif');
  35.  
  36. // and finally for <p>
  37. $css->setStyle('p''font''12pt helvetica, arial, sans-serif');
  38.  
  39. // let's make <body> inherit from <p>
  40. $css->setSameStyle('body''p');
  41.  
  42. // and let's put this into a tag:
  43. echo '<body style="' $css->toInline('body''">';
  44. // will output:
  45. // <body style="background-color:#0c0c0c;color:#ffffff;font:12pt helvetica, arial, sans-serif;">
  46.  
  47. // ideas for inline use:
  48. //    * use in conjunction with HTML_Table to assign styles for cells
  49. //    * integrates easily into existing classes
  50.  
  51. ?>

Documentation generated on Mon, 11 Mar 2019 10:16:41 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.