Skip to page content or skip to Accesskey List.
Search evolt.org
evolt.org login: or register

Work

Main Page Content

A Corporate Redesign - Part I

Rated 3.75 (Ratings: 9) (Add your rating)

Log in to add a comment
(21 comments so far)

Want more?

 
Picture of shifter

Stephen Taylor

Member info | Full bio

User since: January 23, 2003

Last login: October 31, 2005

Articles written: 4

As standards become more and more essential in our design, we still seem to find web sites without such a policy. Sites like Amazon.com have already been re-designed during this time of standards, but without any type of valid code. Fellow developers have sought out to quickly re-code some of these sites to show the quick and easiness of it all. Yet the companies themselves have failed to implement the standards. It has been the small-business pioneers of such reformation of the web.

Another such culprit of bad corporate design is Microsoft.com. Their site renders exactly as they wanted it to, only in IE and not in any other browsers. They have used extensive JavaScript to provide their menus, client sniffing, and IE specific code. Their main page cannot even be validated as it is missing a DTD causing the W3C validator to fail it immediately. Adding a DOCTYPE isn't even the beginning of the page's problems.

However, there is good news. The Microsoft site can be simply redesigned, becoming a new page with the same look, accessible to all, and valid to W3C Standards. We’ll start by fixing the vertical menu on the left of the index page. It will look exactly as it does, display in all browsers, but will coded in be valid XHTML and CSS. We're going to do this as an example to how the tools we've been given allow us to do various things that can really spice up a site, without giving up on standards, validation, and accessibility.

XHTML

First, we need to convert the menu to compliant XHTML code. The original markup is an ugly mess of nested tables and thick, unreliable code. This menu, merely a long list of links, should be coded using the UL tag. We will define the UL tag as a part of the "microsoft" class. Then, we will be able to define the style for that class to display it as our menu. I have also added some specific ID's to the menu options that have a submenu display. We will address those later. Here is the code for the main menu:

<ul class="microsoft">
<li><strong>Product Families</strong></li>
<li><a href="#">Windows</a></li>
<li><a href="#">Office</a></li>
<li><a href="#">Servers</a></li>
<li><a href="#">Developer Tools</a></li>
<li><a href="#">Games and Xbox</a></li>
<li><a href="#">MSN Services</a></li>
<li><a href="#">Business Solutions</a></li>
<li><a href="#">All Products</a></li>
<li><hr /></li>
<li><strong>Resources</strong></li>
<li><a href="#" id="VsupportActuator">Support 
></a></li>
<li><a href="#">Downloads</a></li>
<li><a href="#">Windows Update</a></li>
<li><a href="#">Office Update</a></li>
<li><a href="#" id="VlearningActuator">Learning 
Tools ></a></li>
<li><a href="#">Communities</a></li>
<li><a href="#">Security</a></li>
<li><hr /></li>
<li><strong>Information For</strong></li>
<li><a href="#">Home Users</a></li>
<li><a href="#">IT Professionals<br />(TechNet)</a></li>
<li><a href="#">Developers (MSDN)</a></li>
<li><a href="#">Microsoft Partners</a></li>
<li><a href="#" id="VbusinessActuator">Business 
Professionals ></a></li>
<li><a href="#">Educational Institutions</a></li>
<li><a href="#">Journalists</a></li>
<li><hr /></li>
<li><strong>About Microsoft</strong></li>
<li><a href="#">Mission and Values</a></li>
<li><a href="#">Investor Relations</a></li>
<li><a href="#">Windows Update</a></li>
<li><a href="#">Careers</a></li>
<li><a href="#">About this Site</a></li>
<li><hr /></li>
<li><strong>Worldwide</strong></li>
<li><a href="#">Microsoft Worldwide</a></li>
</ul> 

Notice that this code is valid XHTML. I used the UL tag with the class "microsoft" to define the style of the menu. I will be defining those styles later. The HR tags also have to be included as an element in the list, with an LI tag, or the code won't validate. The next section of the menu is the three submenus which include some more menu options. They will be coded the same as the main menu, but will have a "submenu" class. Each "submenu" also has an ID attribute that relates to the ID's we used earlier on the main menu. The code looks like this:

<ul class="submenu" id="VsupportMenu">
<li><a href="#">Support Home</a></li>
<li><a href="#">Knowledge Base</a></li>
</ul>
<ul class="submenu" id="VlearningMenu">
<li><a href="#">Training &amp; Certification</a></li>
<li><a href="#">Books</a></li>
<li><a href="#">Events</a></li>
</ul>
<ul class="submenu" id="VbusinessMenu">
<li><a href="#">Small Business</a></li>
<li><a href="#">Large Business</a></li>
<li><a href="#">Industry</a></li>
<li><a href="#">Government</a></li>
<li><a href="#">Service Providers</a></li>
</ul> 

And that, my friend, is the end of the code for our menu. However, it doesn't work very well and it doesn't look good either. Next, we will be added some style, then we can make this menu functional with JavaScript.

(CSS)tyle

Now we need to define our styles for all of the items of the menu. The classes that need to be covered are "microsoft" and "submenu", those classes also include list items, as well as the hover and active pseudo-classes. The "microsoft" UL is the container of all the main menu list items, so we will need to define its properties to look like the shell of the Microsoft menu. Each item on the menu has it's own box, which will allow its button like behavior. Those are all defined here:

.microsoft {
margin-left: 0px;
list-style-type: none;
display: block;
font-family: verdana, arial, sans-serif;
font-size: 11px;
color: #000000;
vertical-align: middle;
background-color: #f1f1f1;
border: 1px solid #666666;
width: 205px;
padding: 3px;
}
.microsoft li a {
margin-left: 0px;
list-style-type: none;
display: block;
padding: 3px;
font-family: verdana, arial, sans-serif;
font-size: 11px;
color: #000000;
vertical-align: middle;
background-color: #f1f1f1;
border: 1px solid #f1f1f1;
width: 197px;
padding: 3px;
margin: auto;
text-decoration: none;
}
.microsoft li a:hover {
background-color: #cccccc;
border: 1px solid #999999;
  }
.microsoft li a:active {
background-color: #999999;
border: 1px solid #999999;
}
.microsoft hr {
width: 200px;
color: #999999;
height: 1px;
}
.microsoft strong {
line-height: 20px;
}
.submenu {
visibility: hidden;
display: block;
position: absolute;
font-family: verdana, arial, sans-serif;
font-size: 11px;
color: #000000;
vertical-align: middle;
background-color: #f1f1f1;
border: 1px solid #666666;
width: 150px;
padding: 3px;
margin-left: 0px;
list-style-type: none;
}
.submenu li a {
margin-left: 0px;
list-style-type: none;
display: block;
padding: 3px;
font-family: verdana, arial, sans-serif;
font-size: 11px;
color: #000000;
vertical-align: middle;
background-color: #f1f1f1;
border: 1px solid #f1f1f1;
width: 142px;
padding: 3px;
margin: auto;
text-decoration: none;
}
.submenu li a:hover {
background-color: #cccccc;
border: 1px solid #999999;
}
.submenu li a:active {
background-color: #999999;
border: 1px solid #999999;
}

Notice the use of list-style-type attribute, which gets rid of the bullets; and the display attribute, which makes each item it's own block. The rest of the CSS should be self-explanatory if you've ever worked with it.

JavaScript to the Rescue

The submenus will remain hidden until we call upon them to be visible. I used a slight of JavaScript by accessing the power of the DOM. The code is simple, but it allows the power we need. If a user highlights one of the submenu options, the submenu will be shown. When the user doesn't select anything the submenus will disappear. We first access the element by ID, then wait for a mouseover event to trigger the visibility of the submenu. The script looks like this:

<script type="text/javascript">
<!--
window>

Gimme that Code

Now, we have everything we need. Put it all together and you have a fully-compliant, valid, and accessible Microsoft navigation menu. The menu uses XHTML, CSS, and JavaScript and it works in all browsers. If you'd prefer, get the entire page's code here:

 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
  <title>Standards Compliant Microsoft Menu</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" 
  />
<meta name="author" content="Steve Taylor" />
<meta http-equiv="Content-Style-Type" content="text/css"/>
  <meta http-equiv="Content-Script-Type" content="text/javascript"/>

  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
  <meta http-equiv="Content-Language" content="en-us"/>
<script type="text/javascript">
  <!--
  window>

You'll notice that the submenu lists were not embedded into the main menu. This was done because of a rendering flaw in IE. It adds extra space after it reads a </ul> tag. If anyone knows a fix, please let me know

Next...

Next, time we will recreate the menu in the upper right hand corner. We will employ the same techniques as were used in this menu, with a twist. The menu is inline and has dropdown sub menus. So be sure to tune in for episode two. Until next time.

Stephen Taylor has studied at the International Academy of Design and Technology in Chicago. He also studied for a year at the Milwaukee School of Engineering. He is an intermediate developer who stays on top of emerging technology.

He is interested in web development and learning new things everyday. You'll find him working hard at Visual Echo Designs. Recent work includes American Home Mortgage and The Kuhn Agency. Find out a little more about this complex and exciting young man at his website.

Headings

Submitted by luminosity on February 1, 2003 - 06:12.

Only one small nitpick (which I didn't notice in earlier correspondence) — the headings in the menu should be marked up using &lt;hx&gt; tags rather than using strong. Indeed, using strong here is worse than using b, since b doesn't carry incorrect semantic information with it.

login or register to post comments

A bit hypocritical, maybe?

Submitted by livingdots on February 1, 2003 - 07:26.

It would have worked in Opera 7 if you hadn't used client sniffing (i.e. "window.opera")...

login or register to post comments

window.onload conflict?

Submitted by JimCollins on February 1, 2003 - 17:57.

If you are already using a script that uses window.onLoad(), would there be a conflict? If so you would replace window.onload = function() { VinitializeMenu("VsupportMenu", "VsupportActuator"); VinitializeMenu("VlearningMenu", "VlearningActuator"); VinitializeMenu("VbusinessMenu", "VbusinessActuator"); } with window.onload =(yourexistingfunc();menuinit();) function menuinit() { VinitializeMenu("VsupportMenu", "VsupportActuator"); VinitializeMenu("VlearningMenu", "VlearningActuator"); VinitializeMenu("VbusinessMenu", "VbusinessActuator"); } Also, if you are using switchable style sheets, you would rip out the hardcoded inline style data, insert the stuff that doesnt change into your default style sheet, put the starting color info into the preferred style sheet, and the alt colors into your alt style sheet. If I'm making factual errors here please tell me.

login or register to post comments

Re: Window.onload conflict.

Submitted by luminosity on February 1, 2003 - 18:56.

Jim, of course you'd rip the hardcoded style out if you were putting it on an actual site. Outting it inline is a conveniance for example pages — it lets people easily view and copy the styles that would otherwise be hidden in the stylesheets.

login or register to post comments

some semantics issues, but still a nice start

Submitted by frankfarm on February 2, 2003 - 21:33.

shifter, I like the spirit of your article. Just a few observations:

  • Personally, I wouldn't use <li><hr /></li>. Semantically, that means to me that the hrule is an item in the list, and that doesn't make sense to me. (However, there is at least one argument that <hr /> tags carry meaning, but that still doesn't make it correct that you use it as a list item.) The hrule is both a visual divider but also a structural divider, so I think your single list would be better instead as separate smaller lists, and with heading tags instead of <strong> tags, just as luminosity mentioned above. You could still have the hrules, just code them in your stylesheet rather than as an <hr /> tag. Separating the sections by using separate <ul> lists fixes the structure-semantic issue. Putting the hrules in stylesheets fixes the visual-semantic issue.
  • Opening the sample page in Netscape 2.02 and 3.04 for Windows gives a Javascript error on line 26.
  • In Netscape 4.08 for Windows, no Javascript errors, but the bullets are still visible, the table appears further to the right than in newer browsers, and the font size is a tad smaller than in newer browsers.
  • It would have been a step better to simultaneously promote Web accessibility by using relative (rather than fixed) font sizes in your stylesheets.

Your article is a nice start, but to me the code has some semantic issues, and I am not convinced that it will produce an acceptable result in all browsers.

login or register to post comments

Headings and semantics

Submitted by kirkaracha on February 3, 2003 - 12:53.

I'd put the menu in a DIV because it's easier for positioning and formatting, and make the headings H2s, since they're of equivalent importance and there isn't a subhead for the navigation menu (in which case that would be the H2 and the menu headings would be H3s).

The horizontal lines could be the top borders of the H2s, or the bottom borders of the ULs. Something like this:

#submenu h2 {
border-top: 1px solid #ccc;
padding-top: 5px;
margin-top: 5px;
}
#submenu h2#top {
border-top: none;
}

login or register to post comments

Re: Headings and semantics

Submitted by luminosity on February 3, 2003 - 19:15.

A div carries no semantic weight. this is a list of links. therefore it should be marked up with list markup, even if it is slightly harder to style. that's the point of semantics, you use the right element because it's the right element, not because of how it looks or how easy it is to work with.

login or register to post comments

Not really correct XHTML

Submitted by bertilow on February 4, 2003 - 06:48.

This code is supposed to be compliant XHTML. It's not. The script element has the all to common pseudo comments. Firstly those are not needed anymore since the last browser that needed them died a couple of years ago. Secondly it's not OK to use such pseudo comments in XHTML, since in XHTML they're not pseudo anymore - they're real comments, and a compliant user agent is supposed to ignore the script code. Furthermore, if the server does not indicate the correct character set in the http header, the code must have an xml declaration at the top, indicating "iso-8859-1", else it's not XHTML compliant.

login or register to post comments

Re: Not really correct XHTML

Submitted by luminosity on February 4, 2003 - 06:57.

Furthermore, if the server does not indicate the correct character set in the http header, the code must have an xml declaration at the top, indicating "iso-8859-1", else it's not XHTML compliant.

Only if it's iso-8859-1. If it's utf-8 then it doesn't need anything.

login or register to post comments

Re: Headings and semantics

Submitted by kirkaracha on February 4, 2003 - 12:01.

Ummm...I didn't say I'd have the menu in a DIV instead of in ULs; frankfarm suggested breaking up the menu sections into separate ULs. If the lists are separate, why not use a DIV? Wouldn't a DIV be more syntactically appropriate for an area of the page with lists in it?

login or register to post comments

Re: Headings and semantics

Submitted by luminosity on February 4, 2003 - 18:41.

Ahh, sorry then. For what it's worth, it really wasn't clear that you were saying that in relation to frankfarm's suggestion.

login or register to post comments

Professional Look

Submitted by Nyngan on February 4, 2003 - 23:17.

Great article, but the look is not "the same". Microsofts arrows are gifs, not greater than signs and are right justified in the navigation pane. Microsoft's submenus are all vertically-aligned correctly whereas yours seem a little over the place (according to my browser's representation). Although this isnt a big deal when it comes to the essence of the solution, it means a lot to designers such as myself who need a smart, professional look to their navigation and site. So, my question is 'how would you make the navigation look EXACTLY like Microsoft's?'

login or register to post comments

Opera again

Submitted by livingdots on February 6, 2003 - 08:06.

Hmm. I wonder why Stephen doesn't respond to any of the comments... Did someone hurt his feelings? Anyway, if you want it to work in Opera 7, and at the same time still protect the Opera 6 users from that browser's buggy DOM-implementation, simply replace

if (window.opera) return; // I'm too tired

with

if (window.opera && !document.createComment) return; // pre-Presto U-turn

(BTW, don't forget to make sure the page trigger standards mode also...)

login or register to post comments

The Article

Submitted by shifter on February 6, 2003 - 11:31.

You guys pay attention, so this should be obvious. This article was written right after my other article "More than Standards". It emphasizes the point that unique (in this case just valid) things can be done with the tools we have. The code is good, compliant, it may not live up to everyone standards, but it's just a peek at what can be done. If you actually feel like using this code and possibly ending up on pirated-sites.com, go ahead. It is merely a look at what we can do.

login or register to post comments

No dice on a Mac

Submitted by dommy on February 7, 2003 - 07:17.

"It will look exactly as it does, display in all browsers, but will coded in be valid XHTML and CSS."

Not really.

Define "all". Your new MS page failed on 3 current browsers- Mac OSX IE (5.2), Safari, and NetScape 7.

http://clients.dommy.com/misc/badmsonmac.jpg

login or register to post comments

Re: Professional Look

Submitted by immersion on March 20, 2003 - 12:49.

Forgive me if I'm wrong, but your problems with the menu seem relatively easy to solve - however, I'm not sure whether my methods are compliant, but hey ... I'm sure someone will tell me

Microsoft's submenus are all vertically-aligned correctly whereas yours seem a little over the place

	Vactuator.VshowMenu = function() {
    	Vmenu.style.left = this.offsetLeft + 200 + "px";
    	Vmenu.style.top = this.offsetTop + (this.offsetHeight - 5) + "px";
    	Vmenu.style.visibility = "visible";
    	VcurrentMenu = Vmenu;
	}

Note the this.offsetHeight subtracts only 5 rather than 20? Solution 1.

Next : Microsofts arrows are gifs, not greater than signs and are right justified in the navigation pane

    	
  • Support
  • Solution 2 : Can someone tell me if putting the ID in the li tag is acceptable behaviour? I know it works for me, but compliant is another matter entirely.

    Last thing I want to comment/ask about - in your stylesheets, is shorthand not compliant? eg:

         BORDER: solid 1 #f1f1f1; PADDING: 3;
    
    Cheers

    login or register to post comments

    Redmond wants pixel perfection ...

    Submitted by brothercake on May 1, 2003 - 07:03.

    immersion - your arrow solution is not valid XHTML - there is no such attribute as "align"

    Generally - I'm also impressed with the spirit of this article, but I echo what Nyngan said - it doesn't look exactly the same, and for designers or brand-marketeers, that's important. I tried adding MS proprietary filters to the <ul> elements to get that dropshadow that the real MSDN menus have - and guess what - it breaks the whole thing; or at least it does if you have nested child menus under the main menus - Win/IE will only display menus up to (but not beyond) the level which employs the filter.

    I think the solution is win/ie specific scripting which rewrites the <ul> tree in the DOM and turns all the <li> and <ul> elements into <div>s. I know that's invalid and semantically meaningless markup - but we're only doing it on the fly, and only in Win/IE, so I figure that's okay.

    login or register to post comments

    I don't think removing semantics is okay...

    Submitted by frankfarm on May 1, 2003 - 14:46.

    brothercake, why is that okay? If someone is using Win/IE in conjunction with a screen reader, won't the loss of semantics such as <li> and <ul> cause problems?

    login or register to post comments

    well no ...

    Submitted by brothercake on May 1, 2003 - 15:54.

    It's not really okay, but I'm taking a pragmatic view - if invalid markup is what makes it work right in IE, then that's better than valid markup which doesn't work right, on a kind of lesser of two evils rationale.

    But hmm .. I hadn't thought about screenreaders. I know JAWS is intelligent enough to deal with script generated content, because it works so closely with IE, so whether dynamically changing the semantics would affect it to the extent that it doesn't announce them as list items at all ... I don't know. I can try it out tomorrow..

    login or register to post comments

    Here's what happened ...

    Submitted by brothercake on May 2, 2003 - 01:29.

    Yup - JAWS picks up the dynamic change of semantics and doesn't announce them as list-items. Here's my test page.

    But this is interesting - when the list is a normal list, JAWS reads it item for item without a pause - "bullet this page link item 1 bullet this page link item 2" and so on. But when they're DIVs, it pauses for a second after each one - "this page link item 1 ... this page link item 2 ..." and so on. In my opinion the second result is more pleasant to listen to, because it's better annunciated (I haven't changed any of JAWS' default settings) . The fact that the list items aren't announced as list items need not necessarily be a problem ....

    ... because, given that JAWS has this much understanding, I'm pretty sure it's possible to make a menu system which is fully interactive to JAWS - using keystrokes to go up, down, left and right through the menu structure - if each link announces something like "link this page Home ... link has a submenu which opens to the right" and then "menu has five links ... link this page Sitemap ... link this page Preferences ..." and so on. If this pans out to be possible, then the fact that the links aren't announced as list items is better than that they are, in my opinion.

    Thoughts?

    login or register to post comments

    cannot find the javascript code...

    Submitted by xix on September 29, 2005 - 13:38.

    Thanks for impressive menu... but where is the JavaScript code in "JavaScript to the Rescue" section?
    thank you!

    login or register to post comments

    The access keys for this page are: ALT (Control on a Mac) plus:

    evolt.orgEvolt.org is an all-volunteer resource for web developers made up of a discussion list, a browser archive, and member-submitted articles. This article is the property of its author, please do not redistribute or use elsewhere without checking with the author.