Aleksandar • Vacić

iOS bits and pieces

IE7 float clearing

Remember this?

1
* html SELECTOR { height: 1% }

This is one of the ways you can force IE6 to clear the floats in a container. And it partially works in IE7 too. The reason height:1% works is that IE7 internal engine is same as IE6, just with a lot less bugs in it. Why is float clearing a problem then? Because this part of the selector: * html does not work anymore - that bug is fixed.

However, IE7 still incorrectly interprets height:1% rule and will automatically expand the height of the box in question if its floated content can’t fit. Thus, that trick is still a viable solution to float clearing, especially since IE7 does not support :after selector yet, thus the solution working in all other modern browsers is not usable:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
SELECTOR:after {

  content: ".";

  height: 0;

  display: block;

  visibility: hidden;

  overflow: hidden;

  clear: both;

}

The way forward

The * html will not match anything in IE7 and will have no effect at all. This also is an ugly hack: we use one IE bug applied through another IE bug. Ugly. Such hacks should be used only as last resort, when no other solutions are available. And IE has perfect solution available, called conditional comments.

Thus, using conditional comments the height:1% is still a fine solution for float clearing. However, there is a better one. IE7 now supports min-height rule (among others) and that rule also triggers the infamous hasLayout property in IE7 internal engine and thus it is usable for float clear.

1
SELECTOR { min-height: 0; }

This is simple to use (just put it at the start of your CSS file) and enumerate the elements which content should be cleared - the same list you use for IE6. And all is fine, because this can sit in your main .css file and no modern browser would choke on it.

IE7 has good enough support for the CSS2.1 that you should very rarely need to write IE7-only hacks, thus have little use for separate file containing IE7 tweaks. Actually, the float clear is the only thing I needed to change in all the sites I created in the last few years to make them working in IE7.

What a welcome change.

IE7 bug 1: nested list (abs. positioned) is overrun by preceding link's background colour

I have encountered one ugly bug in IE7 rendering engine, which you could see in the last week at the main navigation of this site (at the top). It manifests when hovering items that has submenus, in which case nested list of items appears, like this:

Working layout

However, in IE7 you would’ve seen this:

Buggy layout

I had no idea what caused this, even asked in IE’s web dev forum without any answers received. Then, last night, while working on new version of this two-level navigation, I realized that it works, with bare styling. After an hour or so spent dissecting the CSS rules one by one, I found the culprit.

I have used the following rule to style the curently hovered main item:

1
2
3
4
5
6
7
ul.navig li:hover a {

  color: #000;

  background-color: #ff4500;

}

The problem is the background-color rule. As soon as you remove it, sub-items re-appear. I have changed the style into this, which does not trigger the bug:

1
2
3
4
5
6
7
8
9
10
11
ul.navig li:hover {

  background-color: #ff4500;

}

ul.navig li:hover a {

  color: #000;

}

Take a look at the example page which illustrates the problem. This is the nastiest IE7 bug I have encountered so far.

Apart form this, IE7 did not bring much problems. It is a very good release where most of the IE6 bugs are resolved. Some have remained though, like z-index problems. The lack of support for the :after pseudo-selector requires you to use zoom:1 in all places where you have used height:1% previously - in the IE7 only styles hidden by cond. comments (there are other solutions as well).

One another bug have remained too, again with this type of navigation, which I will demonstrate in another post.

Interface themes

I think I mentioned several times that I’m a designer turned developer. And as such, my preference in both web and interface design have always been:

  • simplicity

  • subtle

  • grey(ish)

  • smooth

Ever since WindowsXP appeared, the theming community blossomed. There were apps that could turn even Windows95 into something completely different, but it really took off with WinXP. A simple hack on uxtheme.dll was all that was needed - you could then play for days trying out endless themes and visual styles found on sites like devianArt, NeoWin, WinCustomize, GetSkinned and many others.

In this huge forest, really worthwhile trees were a rare find. In my time, I tried probably 50 or so various themes. I did not like the default Luna theme - too flashy, too big (buttons and bars), too colourful…too many distractions. 95% of the themes seems created for high-school kids obsessed with FPS-like interfaces. This is dominant trend which is not likely to get beaten soon with the only contender being even worse - endless replicas of MacOSX interface.

2006 F1 season

I followed F1 races through this no-posting period and there was plenty of interesting things to see. First, Ferrari resurected themself. First they win in Imola, then they win the European GP - Schumacher masterfully drove both races and defended from Alonso. I might also add that Alonso is amazingly cool-headed driver - he tries few times, sees that is not possible and decides against the risk. He has shown last year that he is great driver and now he shows a lot of common sense.

Not that I like that in a driver - I’m there for excitement, not reason :). Current shitty points system really drives the driver towards such behavior. I much prefer the MotoGP points system.