css - How to dynamically center an image that repeats on the x-axis with javascript? -


i have background image 1500px in width , repeats on x-axis. dynamically center image no matter user's viewport width image's center in middle of screen?

how can accomplish javascript?

you shouldn't need javascript this, css (or should) fine:

background-position: center center; background-repeat: repeat-x; 

that line ensure image centered in element, , repeats starting center of element. more info on background-position here.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -