function equal(className) { var findClass = document.getElementsByClassName(className); var tallest = 0; var widest = 0; for(i = 0; i < findClass.length; i++){ var ele = findClass[i]; var eleHeight = ele.offsetHeight; var eleWidth = ele.offsetWidth; tallest = (eleHeight>tallest ? eleHeight : tallest); widest = (eleWidth>widest ? eleWidth : widest); } for(i = 0; i < findClass.length; i++){ findClass[i].style.height = tallest + "px"; findClass[i].style.width = widest + "px"; } }