Skip to content

Instantly share code, notes, and snippets.

@zenolahaye
Last active April 15, 2021 03:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zenolahaye/aed0ac3fc3c8c5dc934c79004a6d782c to your computer and use it in GitHub Desktop.
Save zenolahaye/aed0ac3fc3c8c5dc934c79004a6d782c to your computer and use it in GitHub Desktop.
CSS Fix for iOS vh-unit Bug
/* fix iOS bug not displaying 100vh correctly */
/* Ipad Pro - Landscape-breakpoint */
@media only screen and (min-device-width : 1024px) and (max-device-width : 1024px) and (min-device-height : 1366px) and (max-device-height : 1366px) and (min-width: 1366px) and (max-width: 1366px) {
.fullheight {
height: 1024px;
}
}
/* Ipad Pro - Portrait-breakpoint */
@media only screen and (min-device-width : 1024px) and (max-device-width : 1024px) and (min-device-height : 1366px) and (max-device-height : 1366px) and (min-width: 1024px) and (max-width: 1024px) {
.fullheight {
height: 1366px;
}
}
/* iPad - Landscape-breakpoint */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape) {
.fullheight {
height: 768px;
}
}
/* iPad - Portrait-breakpoint */
@media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) {
.fullheight {
height: 1024px;
}
}
/* iPhone 6/7 plus - Landscape-breakpoint */
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 414px;
}
}
/* iPhone 6/7 plus - Portrait-breakpoint */
@media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 736px;
}
}
/* iPhone 6/7 - Landscape-breakpoint */
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 375px;
}
}
/* iPhone 6/7 - Portrait-breakpoint */
@media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 667px;
}
}
/* iPhone5 */
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : landscape) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 320px;
}
}
@media only screen and (min-device-width: 320px) and (max-device-height: 568px) and (orientation : portrait) and (-webkit-device-pixel-ratio: 2) {
.fullheight {
height: 568px;
}
}
/* iPhone 4 */
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : landscape) and (-webkit-min-device-pixel-ratio : 2) {
.fullheight {
height: 320px;
}
}
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : portrait) and (-webkit-min-device-pixel-ratio : 2) {
.fullheight {
height: 480px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment