Last active
July 26, 2016 15:15
-
-
Save kulicuu/28dabc2ae1ce1de3867ddbfeaa2d2749 to your computer and use it in GitHub Desktop.
centering an image that is absolutely positioned with respect to containers that are fixed percentage of screen width
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # say we have width given ; screen width | |
| width = 360 | |
| image_size = .222222 * width | |
| container_size = .33333333333 * width | |
| #the amount to shift left | |
| left_var = (.5 * container_size) - (.5 * image_size) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment