Coding Sprite Navigation into functional XHTML & CSS. In another recently published tutorial labeled Icon Supported Navigation, some direction was given towards seeing Sprite Navigation being implimented and so here we are.
Now that we have our main mark-up assigned for our navigation, we can get down to coding the CSS for it. The important part I find within the above CSS - besides the entire setup of the navigation - is the ‘outline’ declaration. By applying the outline declaration and setting it to none, you will not get the dotted outline around menu items which often annoyingly includes positioning, margin and padding space. Now that we have the above written, we can move swiftly on to create the alterative states of the navigation by simply editing the background position of the graphic we have already assigned. What we have done above is to create a seperate instance for each menu item by altering the position of the background. As our Sprite Navigation graphic is a horizontal bar, we only have to manipulate the x-axis with the width of each item which in this case is 125 pixels. As we now move down the Sprite Navigation graphic, we alter the value in the y-axis by the height of each menu item, which in this case by 35 pixels. Again we continue down our Sprite so alter the background position by double the height; 70 pixels. Finally, if like me you apply an id attribute to the body tag, you will be able to use the following CSS for a current state declaration. There are other alternatives to coding the current state but I now find this my own prefered route. Part 1 - The Basic Mark-up
Part 2 - Beginning CSS
Part 3 - CSS a
Part 4 - CSS a:hover
Part 5 - CSS a:active
Part 6 - CSS Current State



