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
Post a Comment