Where's the website?

Our advanced systems detected you're trying to access porcupine colors by an old and deprecated browser like Internet Explorer 7 or even 6!
This website uses some technologies which can't be detected from such an outdated software.

We urge you to try again by using one of the following browsers: Google Chrome, Apple Safari, Opera ή Mozilla Firefox.

porcupine colors

category_img

CSS hacks

CSS hacks are lines of code inside a CSS file which replace certain code with another in order to achieve the best possible design for all browsers.

Actually most of the hacks have to do with Internet Explorer 6 and below. Everybody knows that IE has caused the most troubles in Web design and it still does.

The following hacks are simple solutions which can be easily applied, not a complete guide to CSS hacks.

The !important hacks

#nav {
border: 1px solid #ccc; !important;
border: 1px solid #ccc;
}

This hack is based on the fact that IE6 (and below) cannot treat many properties in a rule. Thus, IE will read the second property and it will ignore the first, while in the modern browsers the !important will prevail.

Since old IE cannot treats dotted lines as dashed, dotted borders look ugly. Thanks to this hack we have an at least solid line as a border for IE.

IE7 knows how to treat dotted lines at last.

The star hack

a:hover {
border: 1px dotted #ccc;
}

* html a:hover {
border: 1px solid #ccc;
}

The first part of the code applies a rule and the second overrides it. This is something that old versions of IE understand.

So, as it happened before, the dotted border is bypassed by IE.

The ch­ild selector hack

html>body{
background: url(back.png);
}

This hack hides from old versions of IE the image back.png.

This happens thanks to the child selector “>” which cannot be recognized by IE. The modern browsers, including IE7, read it and apply the background image.

If this back.png image was a transparent one, this hack might have been a very convenient solution. As everybody knows transparent .png files are also not recognized by old IE.

The attribute selector hack

div[id="content"] {
background: url(back.png);
}

Like before, there is a selector, the attribute selector “[id=”...”]”, which means nothing to IE6 and below. The result is a background image which can be seen in modern browsers but not in old versions of IE.

Apart from these hacks there is another way to solve problems caused by Internet Explorer: the Conditional Comments. I wrote about them a short time ago. I can’t recommend the one solution or the other but little by little I find hacks more convenient for me.

Share this post or make it forever yours:

# Journal Feeds

0 Comments

Add a comment


Please help us crash spam and answer to the question below *:
The name of this website is:
porcupine...
Remember my personal info
Notify me of new comments

How to add better comments:

  • Remember to fill in all inputs with an asterisk like this one: *
  • Get a gravatar Gravatar
  • Tags you may use: a, blockquote, em, strong
  • Please don't insult and don't spam.
  • Wait 5' in case you eant to add a second comment.