Search code examples
cssborder

How to Make a 3D button using CSS?


I have a CSS button that looks like this:

enter image description here

that is formed from this CSS code:

.Button{
 color: #333;
border: 1px solid orange;
border-bottom: 5px solid orange;
background-color: #fff;
font-size: 12px;
margin: 5px;
padding: 1px 7px 1px 7px;
display: inline-block;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
position: relative;
top: 0px;
}

.Button:hover{
cursor: hand; 
cursor: pointer;
}

.Button:active{
border-bottom: 3px solid #999;
top: 3px;
}

This is what I am trying to make it look like (but I can't figure out how to do it): enter image description here

Please pardon my drawing skills. I just want to extend the orange border on the left so it looks 3D. Thanks!


Solution

  • This is close, but not quite perfect.

    Using box-shadow & border:

    .Button {
        color: #333;
        box-shadow: -3px 3px orange, -2px 2px orange, -1px 1px orange;
        border: 1px solid orange;
    }
    

    http://jsfiddle.net/grYTZ/3/