Wednesday, May 29, 2019

How to style link as buttons

CSS styles

.my-link{
    margin: 20px 0;
    text-align:center;
}
.my-link a {
    font-size:12px;
    padding: 8px 10px;
    background: #4eb0d7;
    color: #FFF;

    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    border: solid 1px #20538D;

    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
    -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
    -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
}
.my-link a:hover, .my-link a:focus {
    background: #377B96;
    border: solid 1px #2A4E77;
    text-decoration: none;
}
.my-link a:active {
    -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
    background: #2E5481;
    border: solid 1px #27586C;
}

HTML code

<div class="my-link">
  <a href="#"> CONTINUE TO LINK </a>
</div>

the result