Template:Transform-rotate/doc

From Stm32World Wiki
< Template:Transform-rotate
Revision as of 03:38, 17 July 2021 by Lth (talk | contribs) (Created page with "{{Documentation subpage}} <!-- Categories and interwikis go at the bottom of this page. --> A shorthanded CSS code for rotating elements inside style...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Mbox 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.
  • The named parameter Template:Para allows you to change the CSS display property. It defaults to display: inline-block;

When using this template to create the rotating effect, editors should consider carefully about the accessibility.

Template:A note This template does not support IE8 or older. 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:
<syntaxhighlight lang="html">5 5 5 5</syntaxhighlight> 5 5 5 5
  • Some rotated special characters (useful when the font-family has no italic or oblique font):
<syntaxhighlight lang="html"> </syntaxhighlight>
  • Works with numbers, too
<syntaxhighlight lang="html">0 1 2 3 4 5 6 7 8 9</syntaxhighlight> 0 1 2 3 4 5 6 7 8 9
  • Or with arbitrary text
<syntaxhighlight lang="html">This text
is vertically
aligned.

 
This text is upside down.</syntaxhighlight>
This text
is vertically
aligned.

 
This text is upside down.
  • This is a placeholder image, It is rotated 90 degrees clockwise.
<syntaxhighlight lang="html"></syntaxhighlight>
  • This is a red horizontal line drawn across the text at the angle of 30 degree anticlockwise.
<syntaxhighlight lang="html">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</syntaxhighlight>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Serious bug:

Syntax Result
<syntaxhighlight lang="html">The text will be rotated, but not the space the text need to display. So the cell is not tall enough, but much much too wide.</syntaxhighlight> The text will be rotated, but not the space the text need to display. So the cell is not tall enough, but much much too wide.

See also: