PEAR logo

HTML_CSS : The Definitive Guide

Allow duplicate definitions

Internet Explorer <= 6 does not handle box model in same way as others browsers that are better W3C compliant. For this reason, we need to fix boxes size with a hack such as this one you can find in example that follow. You can notice the duplicate 'voice-family' and 'height' properties.

To parse these definitions we need to activate the duplicate option of HTML_CSS.

  1. #header {
  2.   background-color: ivory;
  3.   font-family: "Times New Roman", Times, serif;
  4.   font-size: 5mm;
  5.   text-align: center;
  6.   /* IE 5.5 */
  7.   height:81px;
  8.   border-top:1px solid #000;
  9.   border-right:1px solid #000;
  10.   border-left:1px solid #000;
  11.   voice-family: "\"}\"";
  12.   voice-family: inherit;
  13.   /* IE 6 */
  14.   height: 99px;
  15. }

There are two ways :

For example here, we could wrote either (allow global duplicate) :

  1. <?php
  2. require_once 'HTML/CSS.php';
  3.  
  4. $attr = array('allowduplicates' => true);
  5. $css = new HTML_CSS($attr);
  6.  
  7. $strcss = '
  8. #header {
  9.  background-color: ivory;
  10.  font-family: "Times New Roman", Times, serif;
  11.  font-size: 5mm;
  12.  text-align: center;
  13.  /* IE 5.5 */
  14.  height:81px;
  15.  border-top:1px solid #000;
  16.  border-right:1px solid #000;
  17.  border-left:1px solid #000;
  18.  voice-family: "\"}\"";
  19.  voice-family: inherit;
  20.  /* IE 6 */
  21.  height: 99px;
  22. }
  23. ';
  24. $css->parseString($strcss);
  25.  
  26. $css->display();
  27. ?>

or also (duplicate on local call) :

  1. <?php
  2. require_once 'HTML/CSS.php';
  3.  
  4. $css = new HTML_CSS();
  5.  
  6. $strcss = '
  7. #header {
  8.  background-color: ivory;
  9.  font-family: "Times New Roman", Times, serif;
  10.  font-size: 5mm;
  11.  text-align: center;
  12.  /* IE 5.5 */
  13.  height:81px;
  14.  border-top:1px solid #000;
  15.  border-right:1px solid #000;
  16.  border-left:1px solid #000;
  17.  voice-family: "\"}\"";
  18.  voice-family: inherit;
  19.  /* IE 6 */
  20.  height: 99px;
  21. }
  22. ';
  23. $css->parseString($strcss, true);
  24.  
  25. $css->display();
  26. ?>
HTML_CSS : The Definitive Guide v 1.5.0 : January 15, 2008