This website uses cookies in order to offer you the most relevant information and services online. Please accept cookies for optimal performance.
Learn More

Fixing CSS and JavaScript Bugs in Internet Explorer

Nov 11, 2015

This article gives the detailed information on how you can fix CSS and JavaScript bugs in Internet Explorer by following the specific instructions.


As many users around the globe are still using Internet Explorer (IE), as a developer we need to deal with the bugs of IE. Certainly IE 6 has been the nightmare of many designers, IE 7 looks better but still had some problems, IE 8 was better still, and IE 9 is certainly much better, but to the extent that you care about supporting older versions of IE. You may face design problems that you need to solve so this article is intended to give some advice. We typically use IE conditional comments to fix the IE issues.

Fixing CSS Bugs

  1. While creating a design or template for a website you should design the same in Firefox or in Chrome. Once the design is completed look for the problems in different versions of IE because IE is the least standards compliant browser. The issues can be fixed by using IE Specific CSS files that do not affect other browsers.
  2. The IE conditional comments can be used in the head section of html page to fix the issues in IE.

    This example only affects IE 6

    <!--[if lt IE 7]>
    <link rel="stylesheet" href="style-ie6.css" type="text/css"/>
    <![endif]-->

    This example only affects IE 7

    &><!--[if IE 7]>
    <link rel="stylesheet" href="/style-ie7.css" type="text/css" />
    <![endif]-->

    This example affects any version of IE

    &><!--[if IE]>
    css codes can be written here
    .container{float:left;width:100%;}
    <![endif]-->

Fixing JavaScript Bugs

Normally IE gives the following JavaScript error when a HTML page loads.

Figure 1
Figure 1

The following error appears in the page because of following reasons

  1. If the <script> block is not written properly.

    For Ex.

    <script type="application/javascript">//Wrong. This will give error.
    Solution:<script type="text/javascript">// Correct

  2. When a JavaScript function is called in onload function but the function is not written in any part of the page.

    For Ex.

    <body onload="init();"If the init function is not written in any part of the page then it will give an error.
    Solution: Remove the JavaScript event and the function.
PHP Application Framework
Batoi Framework is a PHP application framework with an Integrated Development Environment for Next Generation Apps and Services on the Cloud.
Create your web application without worrying about small things.
Give your feedback to improve the article

Need our assistance? We are available with you.

Existing Customer?
Get Support
Talk To Consultant?
Get An Appointment
Contact Us

Batoi global offices and contact details

Stay Connected

Join our community, newsletters, and social media.