Last active
April 4, 2020 20:23
-
-
Save obenjiro/7406727 to your computer and use it in GitHub Desktop.
CrossBrowser Vertical CSS Text
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
/** | |
* Works everywere ( IE7+, FF, Chrome, Safari, Opera ) | |
* Example: http://jsbin.com/afAQAWA/2/ | |
*/ | |
.rotated-text { | |
display: inline-block; | |
overflow: hidden; | |
width: 1.5em; | |
} | |
.rotated-text__inner { | |
display: inline-block; | |
white-space: nowrap; | |
/* this is for shity "non IE" browsers | |
that dosn't support writing-mode */ | |
-webkit-transform: translate(1.1em,0) rotate(90deg); | |
-moz-transform: translate(1.1em,0) rotate(90deg); | |
-o-transform: translate(1.1em,0) rotate(90deg); | |
transform: translate(1.1em,0) rotate(90deg); | |
-webkit-transform-origin: 0 0; | |
-moz-transform-origin: 0 0; | |
-o-transform-origin: 0 0; | |
transform-origin: 0 0; | |
/* IE9+ */ | |
-ms-transform: none; | |
-ms-transform-origin: none; | |
/* IE8+ */ | |
-ms-writing-mode: tb-rl; | |
/* IE7 and below */ | |
*writing-mode: tb-rl; | |
} | |
.rotated-text__inner:before { | |
content: ""; | |
float: left; | |
margin-top: 100%; | |
} | |
/* mininless css that used just for this demo */ | |
.container { | |
float: left; | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="rotated-text"><span class="rotated-text__inner">Easy</span></div> | |
</div> | |
<div class="container"> | |
<div class="rotated-text"><span class="rotated-text__inner">Normal</span></div> | |
</div> | |
<div class="container"> | |
<div class="rotated-text"><span class="rotated-text__inner">Hard</span></div> | |
</div> | |
</body> | |
</html> |
Thanks man
TY!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Work in ie7, ie8 : )