Making CSS UL Menu’s Browser-Consistent

If you’ve ever made a web site and wanted it to look consistent from one browser to the next, then you’re well away of the difficulties that are involved. Fixing these sorts of styling issues can be a major annoyance, however, I like to hunt down issues on my own pages from time to time and stand up to the challenge.

One issue that I can across today was dealing with horizontal menu positioning using unordered lists (<UL>) and some positioning. The positioning wasn’t consistent between browsers or even operating systems.

The bad

I started by opening the affected page in multiple browsers (Internet Explorer, Safari, Chrome, Opera & Firefox) on multiple computers (Mac, Linux & Windows) and getting some initial comparisons. There were 3 different variations and (oddly enough) the same browser didn’t necessarily render the same on a different operating system. So there I was. A puzzle… and I like puzzles.

Some of the first things that I inspected were font sizes and families. It occurred to me that different operating systems may differ in fonts, so it seemed like a good starting point. I tested this by forcing a common font: Arial. That wasn’t the problem. The inconsistencies remained consistent.

I also checked into the possibility that the <UL> or <A> elements were applying different heights. Typically anchor elements, <A>, use a display style of inline. If you’re implementing a menu similar to mine then you’re likely applying a block style, which permits better dimension definition of the element. Forcing height on these elements also did not resolve the issue.

I was running out of ideas, but then it hit me. Line-Height. While the other styles appeared to be consistent between browsers and operating systems, there was one style that I’d previously worked with and knew was certainly NOT consistent: line-height.

The good

After forcing a consistent line-height in my CSS, all browsers suddenly began respecting my intended styling. Sigh of relief.

On that note, its worth bringing up the success that browser competition has brought to HTML and CSS rendering standards over the past few years. The push for the fastest and most capable browser has brought a scattered group of browsers a little closer and the result is that we get to enjoy dealing with fewer and fewer bugs.

While your average Joe web developer may have dug around for hours for this issue to no avail, I must say… I thought it was nice to face such a subtle issue rather than being forced to use some crazy IE specific hacks like for legacy IE.

Sputnik: ECMAScript 3 conformance test suite

An experimental plot to illustrate how the latest stable browsers compare.

Today, The Chromium Blog has officially released their ECMAScript 3 conformance test suite in a form that is more friendly to test in your browser. The test contains over 5,000 tests (currently 5,246) and continues to grow!

The Chromium Blog has also posted some initial results among the top web browsers for Windows (emphasis is mine).

In this example, when running Sputnik on a Windows machine, we saw the following results: Opera 10.50: 78 failures, Safari 4: 159 failures, Chrome 4: 218 failures, Firefox 3.6: 259 failures and Internet Explorer 8: 463 failures.

An experimental plot to illustrate how the latest stable browsers compare.

Putting that into terms of 100% conformance rates: Opera 10.50: 98.5% successful, Safari 4: 97.0% successful, Chrome 4: 95.9% successful, Firefox 3.6: 95.1% successful and Internet Explorer 8: 91.2% successful.

Running the test myself in the latest Opera 10.50 snapshot for Linux (Build 6242 ) I’m seeing a solid 77, proof that Opera 10.50 is progressing still!

As explained in their post, the goal of this test is not related to Javascript performance in terms of speed, but in terms of conformance to the spec. Ideally all browsers would be in the center of the bullseye, meaning they all conform and behave (nearly) identically.

The Sputnik tests have been released as an open source project, so if you’re interested in providing conformance test cases to improve the future web..now is a perfect chance to get involved. ;)

To run the test yourself or learn more about it, visit: http://sputnik.googlelabs.com/

Internet Explorer 8 Beta 2 Now Available

internet-explorer-8-beta-2-01

Internet Explorer 8 Beta 2 is now available for testing! If you would like to learn more about it’s release you can find plenty of information on the official release blog post.

If you would like to download and test Internet Explorer 8 yourself, you can find it here:
http://www.microsoft.com/ie8

You’ll find versions for 32- and 64-bit editions of Windows Vista, Windows XP, Windows Server 2003, and Windows Server 2008. In addition to English, IE8 Beta 2 is available in Japanese, Chinese (Simplified), and German. Additional languages will be available soon.

If you would like to see an overview of the new features implemented in Internet Explorer 8 then you can find them in great detail here:
http://blogs.msdn.com/ie/archive/2008/08/27/internet-explorer-8-beta-2-now-available.aspx

Enjoy the early notification so you can be one of the first to test out Internet Explorer 8 Beta 2!

UPDATE (2008-08-28 @ 12:38 AM):
Internet Explorer 8 Beta 2 passes the Acid2 Test! Reports were made back in late December 2007 that internal builds of Internet Explorer were passing the Acid2 Test, but now we have a public release that is passing.

On the Acid3 Test, Internet Explorer 8 Beta 2 scores a 21/100 with a notification at the top of the window stating that:

This website wants to run the following add-on: ‘MSXML 3.0 SP10′ from ‘Microsoft Corporation’. If you trust the website and the add-on and want to allow it to run, click here…

After running the “MSXML 3.0 SP10″ add-on, Internet Explorer 8 Beta 2 still only scores a 21/100.

CSS: More on Acid Testing…Acid3 Test!

acid2A while back I blogged a piece on Internet Explorer and Web Standards. Well, I’m back at it! Only this time I have some good news and some disappointing news.

irst off, the good news is that Internet Explorer 8 is rumored to have passed the Acid2 Test, however, Internet Explorer 8 has not yet been release to the public in any form and this rumor is based on internal testing. No actual proof is available to the public until we get to test this future release ourselves. There is, however, a screenshot posted online to further support the statement, but I would still like to see Internet Explorer 8 perform. ;)

On to the on-topic content, which also contains the bad news. :P WebStandards.org recently officially release the Acid3 Test to the public! The test has been available all along the way (the test itself took some time to develop) and I checked it out from time to time while I was waiting, but testing an incomplete test isn’t really testing at all.

I was surprised when I first saw the Acid3 Test that it didn’t have anything really comparable to the smilie face as seen in the Acid2 Test when rendered properly. However, a lot of work and code has been put into this third Acid project and it is an intensive test for all browsers! I was glad to see that Opera was the leading browser when it comes to the Acid3 Test. Although Opera currently fails the test, they achieve a score of 60/100. I ran the test in several other browsers to compare the results and here is what I found thus far:

  1. Opera 9.5x (weekly build): 60/100
  2. Firefox Minefield (nightly build): 59/100
  3. Firefox 3.0b3pre: 57/100
  4. Firefox 2.0.0.10: 50/100
  5. Opera 9.25: 47/100
  6. Safari 3.0.4 (523.15): 40/100
  7. Internet Explorer 7: 13/100
  8. Opera 8.54: 2/100

It’s a neat test (not as visually cool as the Acid2 Test)! I recommend that you test your browsers with the various Acid Tests every now and then to keep track of how well they are actually doing their job and following web standards! Please let me know if you see any different results or if you have results for versions that I wasn’t able to test!

Internet Explorer

Internet Explorer..we’ve all seen it develop over the years. Or have we? We’ve seen Internet Explorer release a new version of their browser from time to time, but how much are they really packing under the hood?

You’ll read reviews and cool new features online around Microsoft enthusiast sites, but how many of the new features and updates aren’t already available in an alternative browser? Internet Explorer 7 seems to be the new cool browser of choice among a very large percentage of web surfers, but why are they using it? Is it because of the built-in search box in the upper right corner? Is it the super cool new tabbed browsing? Maybe it’s just the shiny vista-like skin..? Or could it be that it is the most secure browser available?

Basically, all of those questions can be answered with a simple “No”. Many people just aren’t aware that there are better browsers…or to be a little less bias…alternative browsers that can do everything they need! I personally have been using Opera for all of my browsing needs for around nine years now. Around the time that I starting using Opera, Netscape Navigator was a popular choice. However, most people just stuck to what they already had installed, which was Internet Explorer.

acid2Quick facts: A man by the name of Håkon Wium Lie (who is now the CTO of Opera Software ASA) proposed Cascading HTML Style Sheets (CHSS) in October 1994. These style sheets were later used to test browsers compliance to web standards for the first time in 1997. The first test, which was called the Box Acid Test (a.k.a. Acid1 Test), was a simple case test used to help browser developers as they developed and implemented cascading style sheets and accepted it into the web. The next test and probably most famous of the two is know as the Acid2 Test. The purpose of this test was to push developers into implementing new features available through CSS. If a browser passes the test then the page loads fine and looks like a simple little smiley face.

This simple little smiley face is in fact a challenge to reproduce. The test is designed to make the results obvious. Either it passes or it fails. You will see a nasty looking face if it fails (hint: look at it in Internet Explorer here). You should check the Acid2 Test in different browsers that you have installed on your computer and decide for yourself if you want to use a product that has been left behind or if you want to switch to an alternative browser with equal or more features and much better web rendering. Personally I would recommend looking into the following browsers and giving them each a test drive:

The Opera browser has been known for years for it’s record of being the most secure browser available. You are much more likely to get a nasty virus from the web using Internet Explorer than you are while using a browser such as Opera. Opera was also a pioneer in the beginning of tabbed browsing days. Many other browsers saw the potential and jumped to implement the same thing. Opera was also the first browser to include a quick search box at the top of the window. Opera provides a light weight browser with the fasted speeds of any browser from almost every angle and some of the best web standards support. You can’t go wrong with Opera!Anyway, I hope you enjoyed this! Download some of these browsers and give them a try! Any of them are more capable than Internet Explorer. ;)