A button
element can't use a href
attribute. Use an A
(anchor) element instead and style it to look like a button as you've just done.
Use the :hover
:active
pasuados to change the style when a user hovers or clicks the button.
.btn-blue {
background-color: #00FFF0;
border-radius: 12px;
border: 1px transparent solid; /* transparent border */
color: black;
padding: 13px 30px; /* remove 2px as we are now using the border */
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
opacity: 0.6;
cursor: pointer;
}
.btn-blue:hover
{
opacity: 1;
background-color: #00EEE0;
border: 1px #99ccff solid;
}
.btn-blue:active
{
background-color: #00CCC0;
border: 1px #000000 solid;
}
<a class="btn-blue" href="#">Get The App</a>
Now simply replace some of my code above with whatever styles you want.
UPDATE:
If you need a button with a fixed height check this code:
.btn-blue {
background-color: #00FFF0;
border-radius: 12px;
/* add a transparent border or use #00FFF0 for color */
border: 1px transparent solid;
/* Allows us to include the padding and border in an element's total width and height. */
box-sizing: border-box;
color: black;
/* remove the top and bottom padding, we don't need them */
padding: 0px 30px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
font-family: Helvetica, Arial;
/* Use this to set a fixed height so the height won't changes */
height: 35px;
/* Set to same as height so the text is centred in the middle. You can change the font-size or family without the box getting bigger */
line-height: 35px;
/* So that the box doesn't shrink or expand if the font-size changes on hover like in this example. */
min-width: 150px;
opacity: 0.6;
cursor: pointer;
}
.btn-blue:hover
{
font-size: 14px;
font-weight: bold;
opacity: 1;
background-color: #00EEE0;
border: 1px #99ccff solid;
}
.btn-blue:active
{
background-color: #00CCC0;
border: 1px #000000 solid;
}
<a class="btn-blue" href="#">Get The App</a>