www.webdeveloper.com
Results 1 to 9 of 9

Thread: Best IE7 CSS hack?

  1. #1
    Join Date
    Jun 2005
    Posts
    201

    Best IE7 CSS hack?

    What is the best in css hack for IE7? I'm not talking about conditional statements, but actual hacks in the css. Like some demonstrated on this page:
    http://perishablepress.com/press/200...et-explorer-7/

    I just want to target IE7 and no other browser. Thanks
    Barkleigh's Webmaster

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    Generally the simplest hacks are the best, because there is least chance of them going wrong (the star hack for example). Using any of them can lead to unwanted consequences and a lot of difficulties in maintaining code. You should avoid any of them at all costs. If you really need to target IE for anything (and normally it can be avoided), you should use conditional comments.
    Great wit and madness are near allied, and fine a line their bounds divide.

  3. #3
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    I find no need to target IE7 specifically at all, as it handles most things ok. On the occasions where IE7 may need HasLayout triggered to render properly, this can be done without targeting it or affecting other browsers.

  4. #4
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    But to answer the question, the best IE7 hack is

    * + html {}
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  5. #5
    Join Date
    Jun 2005
    Posts
    201
    I also only use them when I absolutely need to, but this time its more for looks than functionality. In both FF and IE, the website works fine, but in IE 7 there is a slight rendering difference. The links on the left side appear to have more padding in IE7 than they do in Firefox. Take a look: http://www.barkleigh.com/

    I could adjust the padding for IE7 by using the hack to make it look more like the Firefox rendering.
    Barkleigh's Webmaster

  6. #6
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    That is due to the different default line heights - setting the line height of the <a>s to something like 1.2em displays the same in IE.

  7. #7
    Join Date
    May 2005
    Posts
    2,040

  8. #8
    Join Date
    Dec 2005
    Location
    American, living in Toronto, ON. CANADA
    Posts
    6,746
    While not a 'hack', I am liking this (placed before "</head>". It trains IE to behave more like other browsers...

    <!--[if lt IE 8]>
    <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
    <![endif]-->
    I build for: Firefox and tweak for IE

  9. #9
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    Quote Originally Posted by WebJoel
    While not a 'hack', I am liking this (placed before "</head>". It trains IE to behave more like other browsers...
    Only problem with that is when javascript is disabled - the whole page layout may break. AFAIK, that also includes a pngfix for IE6, and these scripts have the problem of targeting ALL png images whether transparent or not, which can lead to further complications. They also still cannot resolve positioned or repeated transparent png backgrounds anyway.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles