Last active
August 13, 2017 09:59
-
-
Save ladas-larry/2f691121d6c31707cf0b874495a1257c to your computer and use it in GitHub Desktop.
CSS
This file contains 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
Centering in the Unknown | |
/* Vertically centering an element of known dimensions inside an element of unknown dimensions */ | |
/* image width and height is 24px. Plus 10px padding it comes to 34px. 17px is half of this width and height */ | |
.centeredIcon { | |
padding: 5px; | |
position: absolute; | |
top: calc(50% - 17px); | |
left: calc(50% - 17px); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment