Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to expand an image in HTML by clicking on it

I have an image in my html page.

<img src="http://s3-media1.ak.yelpcdn.com/bphoto/sMONYSiLUQEvooJ5hZh0Sw/l.jpg" alt="" width="200" height="150">

How can I show it enlarged in the same page by clicking on it?.

like image 483
Newbee Avatar asked Sep 30 '13 21:09

Newbee


People also ask

How do you expand an image in HTML?

One of the simplest ways to resize an image in the HTML is using the height and width attributes on the img tag. These values specify the height and width of the image element. The values are set in px i.e. CSS pixels.

How do you make an image clickable in HTML?

How To Create A Clickable Image In HTML? The <img> and the <a> tags together is the most common way of adding a clickable image link in HTML. In a webpage, after adding an image using the <img> tag, make it clickable by adding a <a> tag along with it.


1 Answers

I think this will help you

<img src="http://s3-media1.ak.yelpcdn.com/bphoto/sMONYSiLUQEvooJ5hZh0Sw/l.jpg" class="img" alt="" width="200" height="150">


.img:hover{
    color: #424242; 
  -webkit-transition: all .3s ease-in;
  -moz-transition: all .3s ease-in;
  -ms-transition: all .3s ease-in;
  -o-transition: all .3s ease-in;
  transition: all .3s ease-in;
  opacity: 1;
  transform: scale(1.15);
  -ms-transform: scale(1.15); /* IE 9 */
  -webkit-transform: scale(1.15); /* Safari and Chrome */

}

You can transform Scale as per your requirement.

like image 179
Patwardhan Shantanu Avatar answered Oct 02 '22 21:10

Patwardhan Shantanu