-2

I'd like to create buttons with an image and a centered text on it, here a graphic example: http://www.essenzialmenta.it/wp-content/uploads/2014/03/ytbtn-1.png

Thanks for the help!

mario
  • 147
  • 1
  • 7

2 Answers2

0

Use background: url(yourimage.png) center center no-repeat transparent; on the button with CSS to set a background image.

There are already answered questions on Stackoverflow:

<input type="button"> Background: How to add background image for input type="button"? <button> Background: <button> background image

.button{
        background: url(http://www.essenzialmenta.it/wp-content/uploads/2014/03/ytbtn-1.png) center center no-repeat transparent;
        cursor:pointer;
        border: none;
        padding: 100px;
        }
        <input type="button" name="button" value="Button" class="button"/>        
   
Community
  • 1
  • 1
Syno
  • 1,056
  • 10
  • 25
0

U may try,

css

.button-image{
  height: 50px;
  width: 75px;
  background: url(your-image.jpg) center center no-repeat transparent;
  border: none;
  display: block;
}

html

<button class="button-image">Button Text</button>

you can change the height and width as per your requirement.

LIJIN SAMUEL
  • 883
  • 4
  • 12