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 -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -