There is a certain style of button on the latest YouTube design (most easily found in the footer) where the default state of the button has a very subtle bevel to it, but on :hover and :focus states the button pops up, eager to be clicked.



I think this design works well in the context of YouTube’s footer. 1) The default state is very subdued, meaning these buttons aren’t competing for attention on a site where almost everything else is. 2) You still get the very rich/obvious experience of pushing a button 3) They imply a different functionality than the other links in the footer (press these, and something will happen, press a link, be taken away to another page). They make good on that implication as well, each of those buttons opens up a panel of settings right beneath.
Here’s a remake of them. Start with a button:
<button class="button" role="button">
Button #1
</button>
And the base styles including all three states:
.button {
border: 1px solid #DDD;
border-radius: 3px;
text-shadow: 0 1px 1px white;
-webkit-box-shadow: 0 1px 1px #fff;
-moz-box-shadow: 0 1px 1px #fff;
box-shadow: 0 1px 1px #fff;
font: bold 11px Sans-Serif;
padding: 6px 10px;
white-space: nowrap;
vertical-align: middle;
color: #666;
background: transparent;
cursor: pointer;
}
.button:hover, .button:focus {
border-color: #999;
background: -webkit-linear-gradient(top, white, #E0E0E0);
background: -moz-linear-gradient(top, white, #E0E0E0);
background: -ms-linear-gradient(top, white, #E0E0E0);
background: -o-linear-gradient(top, white, #E0E0E0);
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 0 3px #fff;
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 0 3px #fff;
box-shadow: 0 1px 2px rgba(0,0,0,0.25), inset 0 0 3px #fff;
}
.button:active {
border: 1px solid #AAA;
border-bottom-color: #CCC;
border-top-color: #999;
-webkit-box-shadow: inset 0 1px 2px #aaa;
-moz-box-shadow: inset 0 1px 2px #aaa;
box-shadow: inset 0 1px 2px #aaa;
background: -webkit-linear-gradient(top, #E6E6E6, gainsboro);
background: -moz-linear-gradient(top, #E6E6E6, gainsboro);
background: -ms-linear-gradient(top, #E6E6E6, gainsboro);
background: -o-linear-gradient(top, #E6E6E6, gainsboro);
}
Special thanks to Dennis Sa who sent me a JSbin of some Matte Buttons he was working on which made me think of the YouTube buttons and get started on all this.
Trevor Gerzen applied transitions to them, if that’s to your liking.
The subtleness of the button before hover is a really good idea, especially for footers.
Why
role=button
though? Isn’t that the default role for button tags anyway?I wondered about the
role="button"
too – so I looked it up and found this: http://stackoverflow.com/questions/6562407/what-does-role-button-meanHope this helps
Yes. This is semantically redundant. ARIA roles are only meant to specify semantics where they would otherwise be ambiguous.
How come the margin around the buttons in the preview-images in your post gets smaller and smaller for each one?
Different sized screenshots, at a guess.
Anyone have a tutorial or example of how I could build the menu functionality on these buttons like Youtube does?
They use Ajax…
You should check:
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/
How do you get rid of the dropdown arrows?
You remove the
.button:after
declaration block.I was actually just thinking how cool these looked!
Great post! I LOVE the design of the youtube! Very cool :)
I still prefer your button :p
Nice post! Curious why you use prefixed
box-shadow
? I would rather not prefix a candidate-recommendation CSS features likebox-shadow
orborder-radius
.Actually the button looks so good that its hard to go back to conventional button anymore :p
Great CSS-Snippet! Thank you :)
I’ve always been a fan of the Youtube button. They really are attractive!
so nice! thanx
Great looking hover effect on these buttons. Thanks for sharing!
Funny thing about the buttons – I just went to Youtube to see the buttons. Theese are youtube buttons. Theese are prettier…
Great snippe, thanks. But does anybody know where this little arrow on the right comes from? Couldn´t find it in the code. ( : /
Sorry, found it. ( : )
Awesome.
Why after click the button, the style not back to default state?
After clicking the button, it is in :focus state. To return to the default state, you’ll need to give another element focus (e.g. click somewhere else on the page or handle it programatically).
great work~!
Loved it ! Thank You Chris.
Great post, really think this styling will be useful on future web designs. Thanks
if only there was no need for web kits!
Hi,
I am not able to work with border-radius. I encounter a solid edge when i view it in my browser IE 6.0
hi,
ie will not be support the css3 in directly. u most need the jquery to support that in ie.
i’ll give u the link in some more time..
relay great ……
thanks naresh.. pls send me the jquery link as soon as you get one…
Great CSS-Snippet! Thanks for that. I am great fan of youtube and also want to put this into my blog. this post will help me a lot
Nice idea but not really browsercompatible. Although i am going to use it :)
I love to read and learn from your articles :)
These are very cool buttons, thanks Chris!
Overall this new Google design that includes redesign for YouTube is very clean and good looking. Great step forward more intuitive UI and up to date design.
coool buttons , but i want to explain how to make dropdown menu with this buttons
thank you so much ….
Absolutly great tutorial! Do this kind of buttons always in ps :D
Thanks a lot for that!
thnx Chris
Thanks Chris for this awesome css. Can you explain how to put that down arrow symbol too at the end of each button as shown in the demo?