When I rotate and inline layer with TEXT, it adds extra space (width of large text) on the rotation, I dont want to fix. What is the best way to avoid extra space (width of
You may try to use writing-mode .
The
writing-mode
CSS property defines whether lines of text are laid out horizontally or vertically and the direction in which blocks progress.
https://codepen.io/gc-nomade/pen/rGJGzQ?editors=1100
.rotate {
writing-mode:vertical-rl;
transform:scale(-1);
width:50px;
margin-right:50px;
}
body {
display:flex;
align-items:flex-end;
}
BACKGROUND
TITLE
Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element
or transform:rotate(-90deg)
(which was your first choice), but with a pseudo to reset height according to text-length. (this requires to use rgba() colors and set both line of text in a single container. https://codepen.io/gc-nomade/pen/RLQLJG?editors=1100
.rotate {
width:110px;
}
.rotate>span {
display:inline-block;
transform:rotate(-90deg)
}
.rotate > span:before {
content:'';
padding-top:100%;
float:left;
}
body {
display:flex;
align-items:flex-end;
justify-content:flex-start;
}
BACKGROUND
TITLE
Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element Some randome text here should be close to the rotated element
Both technics here, requires to set a width to the rotating text container and are build from a flex container. It should work in IE,FF,Chrome. (display:table/table-cell
can be another display option for older browser)