Sunday, August 3, 2014

Force Image Width and Height Without Stretching

So here is the story. I just wanted to create an  image tag which has the same size of source image size. My problem was whenever the image source size larger than image tag html element image is fitting to borders.
I found the solution after few hours of googling and changing very few CSS lines.

All you have to do is add a style to your img tag like this.

style = "width: auto;height: auto;"

I'll upload the jsfiddle ASAP.

Happy coding fellows....

No comments:

Post a Comment