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

Source for file CSS_req12194_atrule_api.php

Documentation is available at CSS_req12194_atrule_api.php

  1. <?php
  2. /**
  3.  * @ignore
  4.  */
  5. header('Content-Type: text/plain');
  6. require_once 'HTML/CSS.php';
  7.  
  8. function myErrorHandler($code$level)
  9. {
  10.     return PEAR_ERROR_PRINT;  // rather than PEAR_ERROR_DIE
  11. }
  12.  
  13. $cssDef = <<<EOD
  14. @import  url("foo.css") screen, print;
  15. @media screen { color: green; background-color: yellow; }
  16. @media    print {
  17.     blockquote { font-size: 16pt }
  18. }
  19. html { height: 100%; }
  20. @charset "UTF-8";
  21. @page thin:first  { size: 3in 8in }
  22. @font-face {
  23.     font-family: dreamy;
  24.     font-weight: bold;
  25.     src: url(http://www.example.com/font.eot);
  26. }
  27. EOD;
  28.  
  29. $prefs = array(
  30.     'push_callback' => 'myErrorHandler',
  31. );
  32.  
  33. $css = new HTML_CSS(null$prefs);
  34. $css->setStyle('html''height''100%');
  35.  
  36. $css->createAtRule('@charset''"UTF-8"');
  37. $css->createAtRule('@import''url("foo.css") screen, print');
  38.  
  39. //$css->unsetAtRule('@Charset');
  40.  
  41. $css->setAtRuleStyle('@media''screen''''color''green');
  42. $css->setAtRuleStyle('@media''screen''''background-color''yellow');
  43. $css->setAtRuleStyle('@media''print''blockquote''font-size''16pt');
  44. $css->setAtRuleStyle('@page'':first''''size''3im 8im');
  45. $css->setAtRuleStyle('@font-face''''''font-family''dreamy');
  46. $css->setAtRuleStyle('@font-face''''''font-weight''bold');
  47. $css->setAtRuleStyle('@font-face''''''src''url(http://www.example.com/font.eot)');
  48.  
  49. var_export($css->toArray());
  50.  
  51. echo PHP_EOL .$css->toString(. PHP_EOL;
  52. ?>

Documentation generated on Mon, 11 Mar 2019 15:32:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.