gd
What’s the math behind CSS’s background-size:cover
Here’s a logic behind cover calculations. You have four base values : imgWidth // your original img width imgHeight containerWidth // your container width (here 698px) containerHeight Two ratios derived from these values : imgRatio = (imgHeight / imgWidth) // original img ratio containerRatio = (containerHeight / containerWidth) // container ratio You want to find … Read more