Make CSS 3 and HTML elements work in Internet Explorer 8

Its always a pain to make IE8 work with modern coding techniques. I don't won't to was much time dealing with this old browser and rather concentrate on mobile version. So here I will show 4 easy methods how to make CSS 3 and HTML elements work in Internet Explorer 8.

1. HTML5 Elements like aside, header etc. 

Include this into your header
(You have to copy the html.tpl.php into your theme folder)

<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

2. CSS3 pseudo-classes like :nth-child, :last-child, :checked etc

Include selectivizr

<!--[if (gte IE 6)&(lte IE 8)]>
<script type="text/javascript" src="<?php global $base_url; print $base_url;?>
<?php print base_path() . drupal_get_path('theme','MYTHEME') ?>/js/selectivizr-min.js" />">
</script>
<![endif]-->

 

There is also a module for drupal

3. IE8 can not read media queries so add respond.js

https://github.com/scottjehl/Respond Also here you can use a Drupal module https://www.drupal.org/project/respondjs Note: CSS Aggregation must be switched in order to make respond.js work

4. rgba in IE8

for this I found a nice compass mixin in this blog

@mixin rgba-background($color){
    @include filter-gradient($color, $color);
    @if $legacy-support-for-ie6 or $legacy-support-for-ie7 or
    $legacy-support-for-ie8 {
        background: transparent;

        // set filter as none for IE9+, because IE9+ supprot RGBa
        :root & {
        filter: none\0/IE9;}
    }
    background: $color;
}

 

and this is how you use it

.blackAlpha50 {
    @include rgba-background(rgba(0, 0, 0, .5));
}

 

So you might still need a ie8 stylesheet. This is how to include it in the header of your html.tpl.php

<?php global $base_url; print $base_url;?>
<?php print base_path() . drupal_get_path('theme','MYTHEME') ?>/ie8.css" />

 

Neuen Kommentar schreiben

Kommentare

Mo, 2016-05-30 15:40 – Garcinia Forte Reviews // My developer is trying to

My developer is trying to convince me to move to .net from
PHP. I have always disliked the idea because of the costs.

But he's tryiong none the less. I've been using Movable-type on numerous websites for about a year and am nervous about switching to another platform.
I have heard fantastic things about blogengine.net. Is there a
way I can transfer all my wordpress posts into it? Any kind of help would
be really appreciated!

Mo, 2017-01-09 13:54 – buy house skyrim falkreath // Most of the house crops can

Most of the house crops can grow from cutlings and I hardly ever use seedlings
these days.