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

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -