Last active
December 7, 2015 14:25
-
-
Save benjamincharity/b4499e5ea19eb844e5e2 to your computer and use it in GitHub Desktop.
Styles to create a flippable card.
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
///////////////////////////////////////////// | |
// | |
// Flipable Card | |
// | |
// Markup: | |
// .flip | |
// .flip__inner | |
// .front | |
// .back | |
// | |
// scss-lint:disable SelectorFormat | |
%side_base_styles { | |
@include vendor_prefix( | |
backface-visibility, | |
hidden | |
); | |
height: 100%; | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: 100%; | |
} | |
// scss-lint:enable SelectorFormat | |
// primary container for flipable element | |
.flip { | |
@include vendor_prefix( | |
perspective, | |
1000 | |
); | |
@include vendor_prefix( | |
transform-style, | |
preserve-3d | |
); | |
} | |
.flip--flipped { | |
.flip__inner { | |
@include vendor_prefix( | |
transform, | |
rotateY(180deg) | |
); | |
} | |
} | |
.flip__inner { | |
@include vendor_prefix( | |
transform-style, | |
preserve-3d | |
); | |
@include vendor_prefix( | |
transition, | |
600ms | |
); | |
position: relative; | |
.front { | |
@extend %side_base_styles; | |
@include vendor_prefix( | |
transform, | |
rotateY(0deg) | |
); | |
z-index: 2; | |
} | |
.back { | |
@extend %side_base_styles; | |
@include vendor_prefix( | |
transform, | |
rotateY(180deg) | |
); | |
} | |
} | |
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
///////////////////////////////////////////// | |
// | |
// Flipable Card | |
// | |
// Markup: | |
// .flip | |
// .flip__inner | |
// .front | |
// .back | |
// | |
// scss-lint:disable SelectorFormat | |
%side_base_styles { | |
@include vendor_prefix( | |
backface-visibility, | |
hidden | |
); | |
height: 100%; | |
position: absolute; | |
left: 0; | |
top: 0; | |
width: 100%; | |
} | |
// scss-lint:enable SelectorFormat | |
// primary container for flipable element | |
.flip { | |
@include vendor_prefix( | |
perspective, | |
1000 | |
); | |
@include vendor_prefix( | |
transform-style, | |
preserve-3d | |
); | |
} | |
.flip--flipped { | |
.flip__inner { | |
@include vendor_prefix( | |
transform, | |
rotateY(180deg) | |
); | |
} | |
} | |
.flip__inner { | |
@include vendor_prefix( | |
transform-style, | |
preserve-3d | |
); | |
@include vendor_prefix( | |
transition, | |
600ms | |
); | |
position: relative; | |
.front { | |
@extend %side_base_styles; | |
@include vendor_prefix( | |
transform, | |
rotateY(0deg) | |
); | |
z-index: 2; | |
} | |
.back { | |
@extend %side_base_styles; | |
@include vendor_prefix( | |
transform, | |
rotateY(180deg) | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment