i am trying to make a button with an image in it and some text. i want the image to be align at left and the text to be fully centered. The text should be centered at the width of the whole button and not at the remaining width cause to the image.
i tried with span but with no success
<a href=#><button class="lightgray-btn rightbuttons"><span class="demoimage"><img class="btnimg" src="..." alt="" /></span><span class="demotext">"some text</span></button></a>
i also want to avoid the background-image:url because in mobile i am afraid that the text would be on the image
thank you
This will work for you.
You should not use a button for a simple link. Instead, use a link and style it. You can do it like this for example :
You can specify a minimum width for your background-image and apply the same as padding in left and right of the text. This way your text wont overlap the background-image.
Here’s a simpler way of doing it: