Create CSS 2 Line Text Button

January 29th, 2011 by aditia rahman / No Comments  

     

In today short post I want to create a CSS only button with using 2 line text, actually I inspired by Concentrate Apps Website that implementing this fancy button, I think the result is really cool but the idea is very simple just make two box inside link tag in html, maybe something like this

And the html code

<div>
    <a href="">
        <span class="texttop">Back To Post &#9660;</span>
        <span class="textbottom">Click Here !</span>
    </a>
</div>

View Demo | Download Source

I’m using google font to make the button look more elegant, include the google font CSS link in the html header

<link href='http://fonts.googleapis.com/css?family=Arvo' rel='stylesheet' type='text/css'>

Inside link tag I’m using span in css we can display this as a block, and other CSS featured used in this button are rounded corner feature, text shadow, box shadow and gradient effect.

body {
    background: #ffffff url("back.png") repeat top right;
}

div {
    margin: 150px 0;
    text-align: center;
}

a {
    font-family: 'Arvo', Arial, "Free Sans";
    background: #faa447;
    background: -moz-linear-gradient(top, #ffce2b, #faa447);
    background: -webkit-gradient(linear, left top, left bottom, from(#ffce2b), to(#faa447));
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffce2b, endColorstr=#faa447);
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffce2b, endColorstr=#faa447)";
    opacity: 0.8;
    color: #de4e0d;
    text-decoration: none;
    border: 3px solid #de4e0d;
    -webkit-border-radius: .5em;
    -moz-border-radius: .5em;
    border-radius: .5em;
    width: 200px;
    display: block;
    font-weight: bold;
    margin: 0 auto;
    -webkit-box-shadow: 0px 0px 3px rgba(0,0,0,.5);
    -moz-box-shadow: 0px 0px 3px rgba(0,0,0,.5);
    box-shadow: 0px 0px 3px rgba(0,0,0,.5);
    height: 65px;
}

a:hover {
    background: #ffdb49;
    background: -moz-linear-gradient(top, #ffff00, #ffdb49);
    background: -webkit-gradient(linear, left top, left bottom, from(#ffff00), to(#ffdb49));
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff00, endColorstr=#ffdb49);
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff00, endColorstr=#ffdb49)";
}

span {
    display: block;
    padding: 7px;
}
.texttop {
    font-size:18px;
    text-shadow: 0px 0px 2px #e3e3e3;
}
.textbottom {
    color: #fff;
    font-size: 12px;
    border-top: 1px solid #de4e0d;
    text-shadow: 0px 0px 2px #333;
}

The result may different in each browser especially in Opera and IE

CSS 2 Line Text Button

View Demo | Download Source
        submit to reddit Delicious

No Comment Leave a Comment Subscribe RSS

Leave a Comment