Peter Penzov
Peter Penzov

Reputation: 1658

How to create this image button in css?

I created this png image which I use for button in a web site. The problem is that the png picture must be used several times and this increases the network traffic. I want to create the same picture in css and use it as button. Can you help to create this button in css, please?

enter image description here

Upvotes: 1

Views: 781

Answers (1)

Kevin Boucher
Kevin Boucher

Reputation: 16675

If you are using the same image file in several places, it is only being downloaded once.

That being said, this button is easy to do in CSS:

<input type="submit" class="button" value="New Router" />

.button {
    background: #eeeeee; /* Old browsers */
    background: -moz-linear-gradient(top,  #eeeeee 0%, #b4b4b4 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#b4b4b4)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  #eeeeee 0%,#b4b4b4 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  #eeeeee 0%,#b4b4b4 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  #eeeeee 0%,#b4b4b4 100%); /* IE10+ */
    background: linear-gradient(to bottom,  #eeeeee 0%,#b4b4b4 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#b4b4b4',GradientType=0 ); /* IE6-9 */
    border: solid #676767 2px;
    border-radius: 3px;
    color: #111;
    font-family: Trebuchet, Arial, Helvetica, Sans-serif;
    font-size: 12pt;
    font-weight: normal;
    height: 18pt;
    line-height: 18pt;
    text-align:center;
}

Upvotes: 3

Related Questions