Apple’s Navigation bar using only CSS

In this article we are going to make the toolbar below, using nothing but HTML and CSS. If it doesn’t look overly impressive, then you aren’t using Safari 4. I’ve not written this to show you something you can use in every browser today (though as we shall see it degrades gracefully in browsers that don’t support various CSS3 features), but to show what will soon be possible, and coming down the pipelines of CSS in real live browsers.

Recently Satoshi Kikuchi, at ActLink in Japan, with whom we organize Web Directions East, showed me an HTML and CSS version of the current Apple web site top level navigation, using CSS Transitions to give a smooth transition effect between different tabs. Immediately I wondered whether it could be done without the use of images at all – just 100% pure CSS.

Let’s start by taking a look at Apple’s version – I’m sure most readers will be familiar with it – it graces the top of every page at Apple.com

Apple's version

And, here’s the HTML from Apple’s version.

<div id="globalheader" class="home">
  <!--googleoff: all-->
  <ul id="globalnav">
    <li id="gn-apple"><a href="/">Apple</a></li>
    <li id="gn-store"><a href="http://store.apple.com">Store</a></li>
    <li id="gn-mac"><a href="/mac/">Mac</a></li>
    <li id="gn-ipoditunes"><a href="/itunes/">iPod + iTunes</a></li>
    <li id="gn-iphone"><a href="/iphone/">iPhone</a></li>
    <li id="gn-downloads"><a href="/downloads/">Downloads</a></li>
    <li id="gn-support"><a href="/support/">Support</a></li>
  </ul>
  <!--googleon: all-->
  <div id="globalsearch">
    <form action="..." method="post" class="search" id="g-search">
      <div>
        <input type="hidden" value="utf-8" name="oe" id="search-oe">
        <input type="hidden" value="p" name="access" id="search-access">
        <input type="hidden" value="us_only" name="site" id="search-site">
        <input type="hidden" value="lang_en" name="lr" id="search-lr">
        <label for="sp-searchtext"><span class="prettyplaceholder">Search</span
        ><input ...></label>
      </div>

While the HTML is quite clean and nice, the design’s heavy lifting is all done with CSS Sprites and images – with all the attendant challenges for developers and users around that too numerous to recount here.

Now, let’s turn to Satoshi’s version

Satoshi's image based version

You can see it in action here (if you use Safari 3+ )

In some ways, with its use of images, this is very similar to Apple’s version. But, it has that wonderful transition effect, which uses Apple’s experimental (but proposed CSS 3) transitions (and no Javascript!) It does however continue to suffer from being imaged based.

Image free Apple Navigation

Now, my challenge was to see whether we can reproduce the look of the Apple site navigation using only CSS and HTML – no images, no JavaScript. Let’s take an inventory of what we’ll need to do:

  • The left and right edges of the navigation have rounded corners
  • The navigation element has a drop shadow
  • The text of each tab has drop shadows
  • In both the normal and hover states, there’s not a solid color, but rather a gradient. And it’s not simply a gradient which linearly transitions from one color to another – it has a “stop” at about 60% down the background of the tab to give a subtle beveling effect.

Is it really possible to do all these with CSS (or experimental proposed CSS 3 extensions)? And to do so in such a way as older browsers won’t completely break when they try to render the navigation? We’ll, let’s see.

The basics

First we’ll create the basic layout – using the age-old technique of floating the list items inside the list that is our navigation (afterall, what is navigation but a list of links?). We make the list items block elements, float them either right or left, add a bit of padding, a height, width and so forth, and end of with something like this

Here’s the HTML

<ul>
  <li id="home">
    <a href="">Home</a></li>
  <li id="mac">
    <a href="">Mac</a></li>
  <li id="store">
    <a href="">Store</a></li>
  <li id="ipod">
    <a href="">iPod</a></li>
  <li id="iphone">
    <a href="">iPhone</a></li>
  <li id="download">
    <a href="">Download</a>  </li>
  <li id="support">
    <a href="">Support</a></li>
</ul>

and the CSS

ul#navigation li {
  list-style-type: none;
  display: block;
  width: 8em;
  float: left;
  text-align: center;
  font-family: "Lucida Grande", sans-serif;
  height: 3em;
}

Next, we’ll style the links inside these list items like so

ul#navigation li a {
  display: block;
  padding: .8em .5em .5em .5em;
  text-decoration: none;
}

Again, we’ve made them block elements, to help with the layout, and added padding for the same reason, then stopped the browsers default underlining of links.

And here’s what our list will look like

(so that the bar will fit into the narrow confines of this page’s container, I’ve trimmed the number of elements).

Now comes the fun part.

Rounded corners

First up, can we add rounded corners to the left and right edges of the navigation? What we’ll actually do is add rounded corners to the left edge of the first list item, and to the right of the last list item (because the list items inside the list are all floated, the list itself has no height). But we’ll do it without using any specific class or id value on the list items in HTML using the CSS 3 selectors, last-child and first-child.

These selectors select an element when it is the first or last child of its parent element, not the first or last child of an element. Here’s how it works

ul#navigation li:first-child selects any elements with matches ul#navigation li, that is also the first child element of its parent.

Similarly, ul#navigation li:last-child selects any elements with matches ul#navigation li, that is also the last child element of its parent.

So, we’ll create these two rules

ul#navigation li:first-child {
}
ul#navigation li:last-child {
}

Now, we’ll add the border-radius for the relevant edges. Border radius is a CSS 3 property. First we’ll just add the standard property, then we’ll add the browser specific properties as well – at present, while Firefox 3 and Safari 3 support border-radius they do so with the experimental prefixes -webkit- and -moz-, but not the standard property name border-radius.

ul#navigation li:first-child {
  border-top-left-radius: .5em;
  border-bottom-left-radius: .5em;
}

Now, typically the browser specific property name is identical to the standard property name, with the addition of the browser specific prefix. But in this one instance, Firefox’s property name is different – so here are the properties for Safari and Firefox as well as the standard properties we just added.

ul#navigation li:first-child {
  -webkit-border-top-left-radius: .5em;
  -moz-border-radius-topleft: .5em;
  border-top-left-radius: .5em;
  -webkit-border-bottom-left-radius: .5em;
  -moz-border-radius-bottomleft: .5em;
  border-bottom-left-radius: .5em;
}

And similarly for the last child list item

ul#navigation li:last-child {
  -webkit-border-top-right-radius: .5em;
  -moz-border-radius-topright: .5em;
  border-top-left-radius: .5em;
  -webkit-border-bottom-right-radius: .5em;
  -moz-border-radius-bottomright: .5em;
  border-bottom-right-radius: .5em;
}

We won’t be able to see the rounded corners just yet, as the list doesn’t actually have a border yet – but we’ll get to that in a moment.

Shadows

Next, we’ll add a drop shadow to the navigation element, by adding a drop shadow to each list item. By now most developers are probably aware of text-shadow, which was part of CSS 2, removed from CSS 2.1, has returned to CSS 3 and which is now supported by Opera 9.5 and Firefox 3.5 as well as Safari. The box-shadow property is very similar, but adds a drop shadow to the whole box of an element. Shadows in CSS take 4 values – 3 length values which specify respectively the horizontal offset (how far to the left or right of the element the shadow should fall), vertical offset (how far above or below the element the shadow should fall), and a blur value (how sharp or diffuse the shadow should be – the higher the number, the more blurred a shadow is.) The fourth value is the color of the shadow.

ul#navigation li {
  list-style-type: none;
  display: block;
  width: 8em;
  float: left;
  text-align: center;
  font-family: "Lucida Grande", sans-serif;
  height: 3em;
  border-right: 1px #818181 solid;
  -webkit-box-shadow: 1px 1px 1px #bbb;
  box-shadow: 1px 1px 1px #bbb;
}

While we are on shadows, we’ll add the text shadows to our list item text.

ul#navigation li a {
  display: block;
  padding: .8em .5em .5em .5em;
  text-decoration: none;
  color: #292929;
  text-shadow: 1px 1px 0px #cccccc;
}

In addition to the text shadow you’ll notice we’ve also given the text some color.

And here’s what our list looks like with shadows and rounded corners (provided of course you are using a browser which supports these – Safari 3+ and Firefox 3.5+)

So far so good

OK, so far so good – but most developers won’t be too surprised by what we’ve done. But let’s get to the tricky cool stuff. How do we get the gradient effect on the background of the list items? Well, the classic approach is to use a background image. But do we need them? Well, in Safari 4, we don’t. We use an experimental (but proposed standard) value in Safari, -webkit-gradient

-webkit-gradient is a kind of function (there are a number of others functions like attr() in CSS used to add the value of a named attribute as generated content). In programming speak, functions take arguments (or parameters) – in this case, we have the following parameters that the function takes

-webkit-gradient(type of gradient, start position, end position, start color, end color, one or more stop points).

Which all sounds complicated, but as the example below shows, it’s easy enough to understand and experiment with

Here’s our gradient

-webkit-gradient(linear, left top, left bottom, from(#333333), to(#4c4c4c), color-stop(0.6, #474747));

(if you’d like to play round with gradients, try this online tool I put together to explore them.)

Which should for the most part make sense – the color stop might need a little explanation though.

If you look at our navigation element, you’ll notice that at about 60% down the element, the color reaches its darkest, and then gets lighter again. The color stop specifies this, using a value for 0 to 1 to specify where on the gradient the stop should be, and then a color value for that position. Gradients can have multiple stops by the way.

Now, note that this is not a property – it’s a function. In effect, we are generating an image, which can be used anywhere images are – in this case, as a background image (but gradients can also be used as list style images, border images, in generated content, and elsewhere images can be used.) So, we’ll go ahead and add it as the background image for the li elements inside our navigation element.

#navigation li {
  background-color: #c9c9c9;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#c9c9c9), to(#848484), color-stop(0.6, #a1a1a1));
}

We’ve also added a solid background color, for those browsers which don’t support this property (which in early 2009 is all but Safari).

To achieve the rollover effect, we simply add a different gradient to li elements in the hover state.

#navigation li:hover {
  background-color: #333333;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#333333), to(#4c4c4c), color-stop(0.6, #474747));
  }

And here’s what this looks like.

Yep, there are truly no images, no JavaScript, nothing but HTML and CSS. Go ahead and rollover it as well.

Now, we are getting places. And better yet, we’ve not touched our HTML to add extraneous elements, even class and id values for rounded corners or the sliding doors technique, and used no images at all. So, what’s left? Not a lot really. We’ll just add a different text shadow for the text of the li elements in the hover state, and we are more or less done. Well, apart from the issue of transitions.

#navigation li:hover a {
  color: #e8e8e8;
  text-shadow: 1px 1px 0px #353535;
}

CSS Transitions

So, here’s an irony – what started this quest was Satoshi implementing a CSS Transition based effect for fading into and out of the individual tabs when rolling over them – but there’s a bug in Safari – it won’t do transitions with gradients. We’ll look at the code for adding the transition anyway – but if you want to see it in effect, you need to remove the gradients, and you’ll see the transitions on the solid background color.

CSS Transitions, an as yet webkit only CSS property (proposed by Apple as a part of CSS3) provide an animation effect when a specified property or properties change, either due to a user action (like mouse hovering), or due to a script. It makes many of the kinds of effects that JavaScript libraries implement trivial to add to a web page even with no JavaScript knowledge, and no linking to external JavaScript libraries. In its simplest form (which will largely be enough for most developers), you simply specify the property you want to have a transition effect for, and the time the effect should last for.

Here’s a simple example. Let’s give a table row a different background color when it is hovered over (a commonly used technique, to aid readability of tabular data).

tr {
  background-color #fff
  }
tr:hover {
  background-color #a1a1a1
  }

Now, we simply add the -webkit-transition property, specifying that it is background-color which it should apply to, and that we want it to take half a second

tr {
  background-color #fff;
  -webkit-transition: background-color .5s
  }

(seconds are valid CSS 3 units by the way).

Now if we look at this in Safari 3.1 or later, we’ll see that as we hover, the transition from white to grey when hovering (and back again) fades, rather than abruptly changing.

To be or not to be, that is the question whether ’tis nobler in the mind to suffer
the slings and arrows of outrageous fortune Or to take arms against a sea of troubles,
And by opposing end them? To die: to sleep; No more; and by a sleep to say we end
The heart-ache and the thousand natural shocks That flesh is heir to

In our navigation bar example, it’s the li elements we’ll be applying transitions to, because it’s those elements which have the properties applied to them which we want to transition (the background and text color). We saw earlier, the property requires two values – the name of the property to which a transition should apply (or “all” to apply it to every property which changes), and the time the transition should take. In our case, it will look something like this

#navigation li {
  -webkit-transition: all 0.5s;
}

Here’s an example with just a solid background color – roll over it to see the transition in effect in Safari.

As soon as the bug mentioned above is fixed you’ll see a thrilling fade effect when you roll over any of the list elements in the navigation. For now, you’ll need to make the choice as to whether users see the transition effect and a solid background color, or the gradient background, but an abrupt transition on roll over.

Enhancement

The properties we’ve looked at today are a mixture of experimental (though documented, and proposed as standards), and current CSS 3 properties. By and large, they are only supported by Safari at this stage (but some are supported in Opera, some in Firefox 3, and some more will be supported in Firefox 3.5, and Opera 10). Some designers and developers consider this lack of exact consistency between browsers a problem, or even a deal breaker. But, if you are of the view that it’s not the point of web design to make your pages look identical in every browser, but rather to adapt to the browser environment they are viewed in, so that more advanced browsers will deliver a richer experience, while older browsers will still render the pages in such a way as the information and services they offer are available, then there’s no problem with this fact at all.

In fact, this example demonstrates the concept of “progressive enhancement” very clearly.

To begin with, here’s how the page renders in result in IE8 for Windows

the navigation in IE8

Here’s the user’s experience in Opera 9.5

the navigation in opera

Here it is in Firefox 3

The navigation in Firefox 3.0

Here it is in Firefox 3.1

The navigation in Firefox 3.1

and here it is in Safari 3

The navigation in Safari

Opera and IE show no rounded corners, or drop shadows, or gradients, but an otherwise quite acceptable design. Firefox 3 has rounded corners, but no shadows, and no gradients, while Firefox 3.5 has a box-shadow and text shadow. Safari displays all these things, but no transitions.

The really exciting thing is, as Opera, IE, Firefox and Safari add these features and fix their bugs, your pages won’t need updating and refreshing – they will silently just get better.

One last thing to point out – go to Apple’s site and zoom the text – nothing happens. But our design in all of these browsers scales up and down as the user increases and decreases their font size. You can find the text in the navigation using the browsers built in find command (users very commonly search for key words like contact or search on your home page in this way – so if your text is actually an image, then you’ll be driving visitors away.)

The design is far more maintainable – typos and changes to the text are easily fixed without re-rendering a complex design, and uploading the image to a server, performance increases (Satoshi’s original design, which is of course a proof of concept, but for comparison sake uses 15 images, and comes in as close to half a megabyte. Apple’s sprite based image is about 30K, while our CSS based design is 1 CSS file, which is 1.7KB! 300 times smaller than Satoshi’s solution, and 20 times smaller than Apple’s). In addition, accessibility guidelines are easier to adhere to, without the need to resort to image replacement hacks and the like. And it’s one sweet looking design. What’s not to love.

The Wrap

CSS 3, and even experimental CSS can be safely used right now, to create sophisticated lightweight designs, that progressively enhance or fallback according to a browser’s capabilities. Here we’ve merely reproduced what one of the world’s great design companies does on their front page as one of their most significant page elements, using under 2KB of data, a measly 10 statements in total, and not a single image. Now it’s time for you to let loose with some of the new capabilities in CSS, and today’s browsers. Let’s see what you can come up!

Want to learn more?

Creating gradients can be a little tricky, so I’ve put together a little online toy that helps you explore and create them.

Our Wiki now features a complete guide to CSS, including detailed browser support information, for all major current browsers (back to IE5.5). It’s creative commons licensed so you can contribute to it, and reuse it as well.

Style Master 5 (beta version for Mac OS X out now) supports many CSS 3 and experimental CSS features like text and box shadow, border-radius, and more, right now.

CSS 3.info is a great place to keep track of where CSS is headed.

Surfin’ Safari is all about Webkit (the heart of Safari), and its development, and keeps you up to date with the latest in that browser

The Opera blog tracks developments at Opera, whose browser is featured in many many mobile phones, the Wii, the Nintendo DS, televisions and elsewhere. As the web moves away from laptops and PCs, Opera’s browser will become increasingly prominent.

Planet Mozilla brings together Firefox and Mozilla focussed blogs from around the web.

The IE blog is the official blog from the Internet Explorer team. IE8, due out in the first half of 2009, while not implementing many of these new features, is a very important step forward in the standards foundations of the web. Keep track of IE 8 developments there.

Our Web Directions conferences and workshops in Australia, North America and Japan always feature CSS focussed sessions. Keep an eye out for an event near you.

46 Comments

  1. Jacob Rask said:

    In Safari 3.2.3 for Windows I see no gradient, otherwise, nice experiment. The menu looks decent in most browsers, which is OK. In Opera it could be prettier with some SVG though.. :)

    May 28th, 2009
  2. There’s another way to get rid of that last right hand border in the CSS that I use all the time now…

    Get rid of the right hand border and use this rule:

    ul#navigation li + li {
    border-left: 1px #818181 solid;
    }

    Every list item that has another list item before it will get the border applied.

    Nice demo!

    May 28th, 2009
  3. Very cool. It doesn’t fail TOO miserably in FF, and we could feed FF some conditional soup to better-fy it.

    (Thanks to Zeldman for the link)

    May 28th, 2009
  4. Markus Stange said:

    For Firefox 3.5 you could use inset box shadows to create a similar-looking gradient:

    ul.step3 li {
    -moz-box-shadow: 1px 1px 1px #BBBBBB, 0 -50px 50px -30px #848484 inset;
    }

    May 28th, 2009
  5. Nice work. I’ll have to add this to my toolbag.

    May 28th, 2009
  6. Jeff L said:

    Cool, and I look forward to when we can truly do this with better browser support.

    Any reason you are setting the list item to display: block when it’s floated?

    Also, any reason you are setting the rounded corners on the first-child and last-child instead of the parent UL?

    May 28th, 2009
  7. WebDevHobo said:

    Opera 9.5? you do realise 9.64 is the latest version, right?

    May 28th, 2009
  8. Tantek said:

    Simply gorgeous. Well done John.

    May 28th, 2009
  9. John said:

    Thanks all for the comments and suggestions.

    Sadly being in Australia, I tend to have to batch process my replies when I get up!

    Jacob – Gradients are in Safari 4 and webkit nightlies – not yet in iPhone’s Safari either.

    Thanks for the various suggestions – all excellent.

    WebDevHobo – I wrote this back in November, but have been so busy that I only finalized it now. Hence the out of date OPera version. I actually use 10 myself, which has even more cool stuff in it.

    Jeff, because the li’s are all floated, the UL has no height, so adding the border-radius to it won’t show.

    Jacob,

    I’m investigating SVG, and also creating SVG with the Gradient creator – stay tuned!

    Thanks Tantek – I wonder whether part of you wishes you weren’t still playing with Tasman (the rendering engine in IE5 Mac) and could implement some of these CSS3 things.

    May 28th, 2009
  10. john said:

    How about adding the search bar.

    May 28th, 2009
  11. Awsome!

    May 28th, 2009
  12. John said:

    Thanks Yigit!

    John – I do have that in a bigger example. There are some challenges with how these resize with respect to font resizing in the browser that I need to address.

    j

    May 28th, 2009
  13. Hafeyang said:

    cool!

    May 28th, 2009
  14. Charu Sharma said:

    I am a fresher web designer, I have basic knowledge of css & html but don’t have confidence to design sites in css. I want to learn all things which are necessary in css, so can you please tell me some sites or tutorials link where i can learn something good & interesting.
    thanks & rgds

    May 28th, 2009
  15. Very nicely done. I am looking forward to Firefox 3.5 and to Opera 10, hoping they will integrate some of WebKit’s features.

    Once CSS3 becomes mainstream, it’ll be a blast!

    May 29th, 2009
  16. John said:

    Hi Charu,

    stay tuned here, I’ll be posting much more on CSS3!

    j

    May 29th, 2009
  17. a guy said:

    this blows…

    May 30th, 2009
  18. Mujtaba said:

    really cool…
    but just think about the mass of humanity which still uses older versions of IE and firefox…

    May 30th, 2009
  19. James said:

    That is awesome.

    May 31st, 2009
  20. David said:

    this is about 5 years away from being usable in the real world.

    May 31st, 2009
  21. A guy,

    many thanks for highering the tone with your inciteful insightful comment ;-)

    Mujita and David

    You can use this right now – as long as you aren’t obsessed with sites looking identical in all browsers (which they never will anyway), and ensure that text is legible if the background gradient isn’t drawn. In face the header of this blog uses a gradient, which you’ll not see except in Safari 4.

    Now, you can achieve a similar effect using SVG gradient images as backgrounds, which works in Opera. And, you can use SVG in Firefox, Safari and Opera, and VML in IE and achieve very similar effects. So, maybe not so far off ;-)

    thanks

    john

    May 31st, 2009
  22. Edd said:

    Very nice. It might be clearer if you mentioned this works on anything using webkit, not just safari (not tried in konqueror, but it looks great in chrome 2.0)

    June 2nd, 2009
  23. John said:

    Thanks Edd,

    I kind of assumed folks who were aware of those sorts of issues would guess that – tried to keep it simple – but I’ll keep Chrome in mind for future such experiments

    Thanks!

    j

    June 2nd, 2009
  24. Phunky said:

    Although this is a great effect it’s still a propriety style and until it is supported by other browsers i would avoid it.

    You could quite simply add the gradient effect using a simple 1px wide alpha PNG which would then stretch the support to any A Grade browser, apart from IE6 of course.

    I hope these will be come more wide spread thoughout other browsers tho as i do like them :)

    June 3rd, 2009
  25. Steve said:

    This is really neat, but… It’s sort of a glaring difference to me that the Apple’s site has the text color changing to white on hover (and I think the text is also bold.) IMHO those simple changes might make yours look a lot nicer. But otherwise very nice work, it’s awesome to remove the need for images!

    June 3rd, 2009
  26. It’s great to see a real-world use of the extra CSS3 options available to us developers. Normally tutorials just show each effect as in individually option on the most mundane examples.

    2 small fixes with the post:

    1) the link to Satoshi’s example (http://westciv.com/style_master/house/good_oil/satoshi/) goes to a 404.

    2) Your 404 is not correctly linking to your CSS and therefor is un-styled.

    Just a letting you know.

    June 3rd, 2009
  27. Apple’s approach looks better to me.

    June 3rd, 2009
  28. Landon said:

    This is a very good tutorial, but apple does this a little differently

    June 8th, 2009
  29. John said:

    Landon,

    many thanks – in fact Apple does this VERY differently :-)

    Mine is a proof of concept of how it could be done without any images, using features of Safari 4, that hopefully we’ll see in other browsers in the not too distant future

    john

    June 8th, 2009
  30. Ganesh said:

    Nice tutorial !! Pretty easy tut to start with !!!! thanks !!

    June 10th, 2009
  31. paul said:

    very nicely layed out tutorial! i thinks this is a common style that every one is starting to use, but at the same time makes a lot of sense.. thanks

    June 16th, 2009
  32. Neat experiment, can’t wait for CSS3!

    June 16th, 2009
  33. anny2425 said:

    great article….I always use this site for my web design uk based.

    June 21st, 2009
  34. CSS 3 will be the death of IE6 for sure!

    June 30th, 2009
  35. Dmitry said:

    Yes it would be cool.
    If CSS3 was supported by most browsers but it’s not.
    Untill then I stick to old tricks.

    Cheers, DS

    July 11th, 2009
  36. John said:

    I have a love/hate relationship with CSS. Its a shame that browser companies wont sit down together and knock out some ideas of compatibility… after all, they all do the same thing and have the same goals (view web pages / accessible / security / speed / usability)

    Lets get it sorted !!!

    July 11th, 2009
  37. Great article

    August 5th, 2009
  38. David said:

    I’m a beginner at this…I’m having trouble displaying the navigation bar. It shows the list of the navigational link without any of the css features. I included the css file in my html file. Example below shows how it looks in my webpage.
    Home
    Mac
    Store
    I have a feeling it has something to do with the function #navigation not being able to read by the UL. Please help. Thanks

    August 24th, 2009
  39. iç giyim said:

    This is a very good tutorial, but apple does this a little differently…

    October 10th, 2009
  40. how do I align the nav bar to be centered (as opposed to the default left)? Do I alter the float css?

    October 19th, 2009
  41. Danny, do you want the text or the bar itself to be aligned to the left?

    October 20th, 2009
  42. Simply gorgeous. Well done John…

    October 23rd, 2009
  43. Might I point out a flaw in your example code:

    And similarly for the last child list item

    ul#navigation li:last-child {
    -webkit-border-top-right-radius: .5em;
    -moz-border-radius-topright: .5em;
    border-top-left-radius: .5em;
    -webkit-border-bottom-right-radius: .5em;
    -moz-border-radius-bottomright: .5em;
    border-bottom-right-radius: .5em;
    }

    Shouldn’t that be “border-top-RIGHT-radius” ?

    Kashidom Nenakh
    Mantha Designs inc.

    December 17th, 2009
  44. Kashidom,

    Yep, you are right!

    December 17th, 2009
  45. Hediye said:

    Simply gorgeous. Well done John

    December 30th, 2009
  46. Thanks Hedlye – more cool stuff like this coming soon.

    In the meantime, check out these tools for playing with CSS3 properties.

    http://westciv.com/tools/transforms/index.html

    Now with Firefox 3.5/6 and Opera 10.5 support

    December 31st, 2009

15 Trackbacks

  1. By CSSハックマニア その1 | Nutspress on October 1st, 2009 at 1:44 PM

    [...] Handy Tips for Creating a Print CSS Stylesheet Apple’s Navigation bar using only CSS Horizontal unordered lists non-floating Professional Dark CSS Menu Create CSS pin balloons with [...]

  2. [...] Apple’s Navigation bar using only CSS [...]

  3. [...] Apple’s Navigation bar using only CSS [...]

  4. [...] Apple’s Navigation bar using only CSSThis tutorial shows how to create an Apple-like navigation bar using only CSS and HTML (with no images). [...]

  5. [...] [...]

  6. [...] Apple’s Navigation bar using only CSS This tutorial describes how to recreate Apple’s navigation bar, based on a list, with some CSS3 enhancements that degrade gracefully in IE and older browsers. The final result also includes an animated hover effect that works in Safari. [...]

  7. [...] 14. Apple’s Navigation bar using only CSS [...]

  8. By 精通 CSS 造型设计元素 | 芒果 on January 9th, 2010 at 5:38 PM

    [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  9. By 精通CSS造型设计元素 on January 12th, 2010 at 4:04 PM

    [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  10. By 精通 CSS 样式设计元素 - 菠菜博 on January 19th, 2010 at 1:05 AM

    [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  11. [...] Navigation 一份关于创建面包屑导航,并格式化为标签式的全面教程。 Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML [...]

  12. By 精通 CSS 样式设计元素 - 木牛工作室 on January 23rd, 2010 at 7:07 PM

    [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  13. By 精通 CSS 样式设计元素 « 前端设计 on January 28th, 2010 at 5:12 PM

    [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  14. [...] Apple’s Navigation bar using only CSS 该教程说明如何创建一个类似苹果网站的导航栏,仅仅使用 CSS 和 HTML 代码(不附加任何图片)。 [...]

  15. By 15个Apple设计风格代码指南 | 知更鸟 on February 6th, 2010 at 3:33 PM

    [...] 14. Apple’s Navigation bar using only CSS [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*