Dev Tricks and CSS Hacks

Development Tricks

  • To view generated source of js/ajax in IE, copy this address bar: javascript:'<xmp>’+window.document.body.outerHTML+'</xmp>’
  • All html as above:
    javascript:'<xmp>’+window.document.body.parentNode.outerHTML+'</xmp>’

CSS Browser-specific Hacks

  • IE6 Only:
    * html #elementid{}
  • NOT IE6:
    html>body #elementid{}
  • IE7 and below:
    *:first-child+html {}
    * html {}
  • IE7 Only:
    *:first-child+html {}
  • Not IE (invalid css):
    html>/**/body {}

Fixing browser bugs and cross-browser compatibility:

Firefox 3 Legend Bug
This will make the legend act as though it were a block:

HTML

<fieldset>
    <legend><span>Legend text</span></legend>
</fieldset>

CSS

legend {
    margin: 0 0 15px;
    float: left;
    white-space: normal;
}

* html{margin-left:-7px;}
*:first-child+html html{margin-left:-7px;}

legend span {
    width: 400px;
    display: block;
}


Then change dimensions to match project it’s being implemented into
From http://beckism.com/2008/12/display_block_legend/

Leave a Reply

Your email address will not be published. Required fields are marked *