Create a responsive button with image, text and link using css

I tried a few things, but I was out of luck. I need to create a button containing an image and text on top of the background image of a button. In addition, clicking anywhere inside the button should be redirected to a page, for example, google.com. Here's what the button should look like

enter image description here

, , , . , . - ? , , , . . , , . , : JSFiddle

<a href="https://www.google.com" style="color: white !important; background-color: #7FFF00;padding: 25px;width: 50px;"> 
    <span style="margin-bottom: 5%;"> 
        <img src="http://placehold.it/30x30" height:100%; style="display: inline-block;" width="30" height="30" /> 
        <span style="display: inline-block;"> 
            <b><font size ="2" color="BLACK" face="Arial">CLICK ON THE IMAGE TO VIEW MORE DETAILS ABOUT THE ITEM </font> </b> 
        </span> 
    </span> 
</a> 
+4
1

img{
  width:30px;
  height:30px;
}
a{
text-decoration:none;
color:black;}
#img{
  float:left;
}
#img,#text{
 display:inline;
}

#main{
  margin-top:20px;
  width:250px;
  border:2px solid black;
  border-radius:10px;
  background:yellowgreen;
}
#container{
  margin:15px;
  }
div.clickable {
    position:relative;
}
div.clickable #mainlink {
    position:absolute;
    width:100%;
    height:100%;
}
<div class="clickable">
<a href="www.google.com" id="mainlink">
<div id="main">
<div id="container">
<div id="img">
<a href="www.google.com"><img src="http://oer.nios.ac.in/wiki/images/thumb/4/47/Thumpsup.png/200px-Thumpsup.png"/></a>
</div>
<div id="text">
<span>Click on the image to view more about the item</span>
</div>
</div>
</div>
  </a>
  </div>
Hide result
0

Source: https://habr.com/ru/post/1654416/


All Articles