html - Aligning 270 degree oriented div (transform: rotate) -
i have div (tab) rotate 270 degrees so:
-webkit-transform-origin: 100% 0%; -webkit-transform: rotate(270deg);
(example here: http://users.telenet.be/prullen/align.html)
when want align tab top edge of content box, it's pretty easy. set "top" "3px" (the border size). however, bottom it's story.
it appears need calculate jquery so:
$tab.css('bottom', (math.abs($tab.outerwidth()-$tab.outerheight())
(though example i'm using static value. may not want in browser, here's image: )
i wondering if there better way since not seem work in firefox example (1 pixel shift). there easier way adjusting transform-origin perhaps?
(note need keep same div structure have now)
ideally it'd easy setting bottom to: 3px (the border thickness)
thanks.
when want put tab @ top of sticky, apply class .tab-top
.sticky-tab
element.
.tab-top { transform-origin: 100% 0%; transform: rotate(270deg); top: 5px; /*border size*/ right: 5px; /*border size*/ }
when want put tab @ bottom of sticky, apply class .tab-bottom
.sticky-tab
element.
.tab-bottom { transform-origin: 100% 100%; transform: rotate(270deg) translatex(100%); bottom: 0; right: -18px; /*height (appearing width once rotated) of tab*/ }
essentially want change transform origin @ bottom right-hand corner of element , attach element bottom of parent. place element below .sticky
. use translatex(100%)
force bottom of .sticky-tab
align bottom of .sticky
.
Comments
Post a Comment