A comment before the doctype triggers quirksmode in IE7

outer box:
height 200px
width 200px
padding 25px;
border 25px;

I recommend that before using any of these hacks that you look at this page and also google the older blog page by David Hammond.

* html - target IE 7 and earlier

*+html - target Opera 9.10 and 9.24

*~html - target Opera 9.10 and 9.24 and Opera 9.5 alpha

*+*+html

*~*~html

*:first-child+html

html:first-child - target Opera 9.10 and 9.24

*+html:first-child - target Opera 9.10 and 9.24


<?xml version="1.0" encoding="utf-8"?>

<!-- -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en">
 

or


<!-- -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en">
 

Warning the below example will not validate


<!-- -->

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en">
 

  1. CSS hacks
  2. Internet Explorer and the CSS box model
  3. Writing cross-browser CSS
  4. prepared for IE7 - feeding separate styles to Internet Explorer with the @import hack
  5. Thanks to Philippe Wittenbergh for sharing with me the details for Opera 9.5 alpha

CSS Class test