javascript - How to make an image centerd when width of div is less than 300px using inline script? -


i'm new here , noob when comes js. need making image centered using inline script(if right way it) here div image in it. , want use js make centered if logobox div's size less 300px.

<div id="logobox"> <img id="hunterlogo"  height="99"  src="{{media     url="wysiwyg/for- pages/jr-stuff/hunter-hundeartikel.jpg"}}" width="164" /></div> 

i tried use

var = document.getelementbyid("hunterlogo").offsetheight; if(a<300px){ document.getelementbyid("hunterlogo").style.align="middle" } 

the code going used in magento , have option of inline script only. tried different ways on google none of them worked, because lack fundamentals in javascript, need done.

thanks in advance :)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -