html - Setting height of img tag equal to its width -
well googled lot didn't find useful.is there way achieve ?
<img src="1.jpg"height="" width="100%">
use offsetwidth
:
var img = document.getelementsbytagname("img")[0]; img.style.height = img.offsetwidth + "px";
and have use javascript.
Comments
Post a Comment