This is a documentation subpage for Template:Transform-rotate. It may contain usage information, categories and other content that is not part of the original template page. |
A shorthanded CSS code for rotating elements inside style attribute. Use it inside the style=""
attribute of HTML elements like other CSS properties.
- First unnamed Parameter
{{{1}}}
for rotation angle (in degree). Positive values rotate right, negative values rotate left. - Second named Parameter
display=
allows to change the CSS display property. It defaults todisplay: inline-block;
When using this template to create the rotating effect, editors should consider carefully about the accessibility.
Note: This template does not support IE8 or older browsers. IE8 requires cumbersome calculating of matrices. You may implement it into this template if you know how to translate the formula into Lua.
Examples
The rotating happens at the center of the object and its effective dimensions will retain the original values of the object as if unrotated, so you may adjust the position and padding to avoid unwanted overlapping. Use the display=
parameter to further control positioning.
Syntax | Result |
---|---|
*Some rotated characters:<br /><span style="{{Transform-rotate|90}}">A</span> <span style="{{Transform-rotate|180}}">B</span> <span style="{{Transform-rotate|270}}">C</span> <span style="{{Transform-rotate|360}}">D</span>
|
|
This is a placeholder image:
|
This is a placeholder image:
It is rotated 90 degree clockwise. |
<div style="border:3px solid red; width:100px; position:relative; top:30px; opacity:0.5; {{Transform-rotate|-30|display=block}}"/>This is a red horizontal line drawn across the text at the angle of 30 degree anticlockwise.
|
This is a red horizontal line drawn across the text at the angle of 30 degree anticlockwise.
|
See also:
{{MirrorH}}