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!
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!
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"/>
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.