YoutubeButton copy

How to Create YouTube Popup Buttons with CSS

Here’s a very cool CSS trick I found that will let you have the same buttons as those in YouTube’s footer! But first, lots of thanks to the following coders below:

  • Dennis Sa - for the jsbin of the matte buttons http://jsbin.com/efesot/6
  • Trevor Gerzen – for applying the transitions, and
  • Chris Coyier - for coming up with this neat trick and sharing it on the web.

 

114 285x117 How to Create YouTube Popup Buttons with CSS

 

HTML

<button role=”button”>

Button #1

</button>

 

As for the base styles for all three states (default, hover, active):

CSS

.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);

}

 

NOTE: This is short tutorial just teaches you how to mimic the look and not the function. So if you want to be able to include menu functionality on the buttons (like YouTube does) you can check out this link and try incorporating the code there with the one here.

Demo

Download Files

 

 

 

Incoming search terms for the article:

Related Posts

How To Create A Basic Social Sharing Button

Convert PSD Files to HTML and CSS with PSDSlicing

Dabblet CSS and HTML Editor

ExpandingTextarea jQuery Plugin