It's really easy to align the center of a background-image
with the center of the div via background-position
. I can't see any way to align the center of a background-image
with the left side of the div though.
I've tried playing with all sorts of different percentages for background-position
, but I haven't been able to see how exactly the % is calculated outside of 0-100%. I know 0% is left of background with left of div, and 100% is right of background with right of div. But what is -50% or 200%? I think it's adjusting by a ratio of the width of the two items, which is pretty meaningless outside the range.
I made this to try see if I could figure something out.
Anyone have any other suggestions to get the center of a background-image
aligned the left side of the div it's set on?