Jump to content

Template:Transform-rotate: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
fix typo in previous attempt
 
(18 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<includeonly>display: {{{display|inline-block}}}; transform: rotate({{{1|0}}}deg);</includeonly><noinclude>
<includeonly>-moz-transform:rotate({{{1}}}deg);<!--Mozilla: Firefox-->-webkit-transform:rotate({{{1}}}deg);<!--WebKit: Chrome/Safari-->-o-transform:rotate({{{1}}}deg);<!--Opera-->-ms-transform:rotate({{{1}}}deg);<!--IE9--></includeonly><noinclude>A shorthanded CSS code for rotating elements inside span or div. {{{1}}} for rotating degree. It does not support IE8 or older browsers. IE8 requires cumbersome calculating of matrix. You may implement it if you know how to translate the formula into parser function.


<!-- ADD CATEGORIES AND INTERWIKIS TO THE /doc PAGE, NOT HERE, THANKS -->
When using this template to create the rotating effect, editor should consider carefully about the [[WP:accessibility|accessibility]].
{{documentation}}

</noinclude>
==Examples==
The rotating happens at the center of the object and its virtual dimension will retain as the original angle after rotating, so you may adjust the position and padding to avoid unwanted overlapping.

{|class=wikitable
!Syntax!!Result
|-valign=top
|width=50%|<code><nowiki>This is a placeholder image:</nowiki></code>

<code><nowiki><span style="position:relative; top:20px; left:120px; {{rotate|90}}">[[file:placeholder.png|200px]]</span></nowiki></code>

<code><nowiki>It is rotated 90 degree clockwise.</nowiki></code>
|This is a placeholder image:

<span style="position:relative; top:20px; left:120px; {{rotate|90}}">[[file:placeholder.png|200px]]</span>

It is rotated 90 degree clockwise.
|-valign=top
|<code><nowiki><div style="border:3px solid red; width:100px; position:relative; top:30px; opacity:0.5; {{rotate|30}}"/>This is a red horizontal line drawn across the text at the angle of 30 degree clockwise.</nowiki></code>
|<div style="border:3px solid red; width:100px; position:relative; top:30px; opacity:0.5; {{rotate|30}}"/>This is a red horizontal line drawn across the text at the angle of 30 degree clockwise.
|}

[[category:Graphic templates]]

Latest revision as of 15:10, 4 November 2022