Bug Removal Technique

There are techniques which are used to remove bugs to appear when the web page is rendered by the web browser as web page developer is not aware of the web browser being used by the end user hence, the webpage developer should develop the web page so that it renders as expected without any bugs. The two main techniques which are used are

  • Conditional comments
  • Hacks

Conditional Comments – They are similar to an HTML comments, but with specific code to be executed by specific web browser and to be omitted by rest of web browsers. It is of the form

<!–[if lte IE 6]> <![endif]–>

In this example the if part of the conditional comment has an expression to evaluate which means “ if less than or equal to IE 6 ”. Thus, meaning that the code snippet given in between ‘if’ and ‘endif’ is to be executed by web browser if it Internet Explorer and whose version number id 6 or less. Other browser will treat this as a comment and ignore it. In the comment a link or style for IE only CSS is usually given so as to stylize for Internet Explorer versions 6 or less.

Hacks – Hacks are tricks which take advantage of bugs in CSS parsers to include CSS that only works in certain browsers. Few hacks which are useful are discussed

Underscore hack, by which CSS for IE 6 only can be given and it is used as

.top {

_height: 1px;

}

In the example the height property has an prefix of an underscore thus it is not a valid CSS property and ignored by most browsers but, IE 6 ignores just the underscore and interpret the declaration.

Star hack It works similarly but applies for both IE 6 and IE 7 and is used as

.top {

*width: 100px;

}

Most browsers will ignore the invalid property, but IE6 and IE7 will only ignore the star.

Go To- Certified CSS3 Developer Tutorial

Get industry recognized certification – Contact us

Menu