Skip to content

Instantly share code, notes, and snippets.

@Sensiblemnd
Created May 11, 2018 17:46
Show Gist options
  • Save Sensiblemnd/b5987670f449c41c4f7a5f50279b128e to your computer and use it in GitHub Desktop.
Save Sensiblemnd/b5987670f449c41c4f7a5f50279b128e to your computer and use it in GitHub Desktop.
/* ==========================================================================
These following classes can be used to add safe-area padding to the either 4 directions
========================================================================== */
.iphoneXSafeArea--top{
/* iOS 11.2+ */
padding-top: env(safe-area-inset-top);
/* iOS 11 */
padding-top: constant(safe-area-inset-top);
}
.iphoneXSafeArea--right{
padding-right: env(safe-area-inset-right);
padding-right: constant(safe-area-inset-right);
}
.iphoneXSafeArea--bottom{
padding-bottom: env(safe-area-inset-bottom);
padding-bottom: constant(safe-area-inset-bottom);
}
.iphoneXSafeArea--left{
padding-left: env(safe-area-inset-left);
padding-left: constant(safe-area-inset-left);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment