This site is supported by donations to The OEIS Foundation.
Template:Transform-skew
[⧼Purge⧽ Template:Transform-skew]
The {{transform-skew}} cross-browser compatibility template gives the CSS code for skewing elements inside the style attribute. Use it inside the style=""
attribute of HTML elements like other CSS properties.
Contents
Usage
-
<span style="{{transform-skew|angle along X (in degrees)|angle along Y (in degrees)}}">element to skew</span>
or
-
<span style="{{transform-skew|angle along X (in degrees)|angle along Y (in degrees)|display = display}}">element to skew</span>
with arguments
-
angle along X (in degrees)
: first unnamed parameter{{{1|0}}}
for skewing angle along X (in degree, default 0).
- Positive values skews counterclockwise along X, negative values skews clockwise along X.
-
angle along Y (in degrees)
: second unnamed parameter{{{2|0}}}
for skewing angle along Y (in degree, default 0).
- Positive values skews clockwise along Y, negative values skews counterclockwise along Y.
-
display
: the named parameterdisplay
allows you to change the CSS display property. It defaults toinline-block;
.
When using this template to create the skewing effect, editors should consider carefully about the accessibility.
Note: This template is not supported by IE8 or older. IE8 requires cumbersome calculating of matrices.
Examples
The skewing happens at the center of the object's bounding box and it's effective dimensions will retain the original values of the object as if unskewed, so you may adjust the position and padding to avoid unwanted overlapping. Use the display
parameter to further control positioning.
Syntax | Result | |
---|---|---|
| ||
<span style="{{transform-skew|-40}}">A</span> <span style="{{transform-skew|-20}}">B</span> <span style="{{transform-skew|0}}">C</span> <span style="{{transform-skew|20}}">D</span> <span style="{{transform-skew|40}}">E</span>
|
A B C D E | |
<span style="{{transform-skew|-40|0}}">A</span> <span style="{{transform-skew|-20|0}}">B</span> <span style="{{transform-skew|0|0}}">C</span> <span style="{{transform-skew|20|0}}">D</span> <span style="{{transform-skew|40|0}}">E</span>
|
A B C D E | |
<span style="{{transform-skew|0|-40}}">A</span> <span style="{{transform-skew|0|-20}}">B</span> <span style="{{transform-skew|0|0}}">C</span> <span style="{{transform-skew|0|20}}">D</span> <span style="{{transform-skew|0|40}}">E</span>
|
A B C D E | |
| ||
<span style="{{transform-skew|-40}}">∫</span> <span style="{{transform-skew|-20}}">∫</span> <span style="{{transform-skew|0}}">∫</span> <span style="{{transform-skew|20}}">∫</span> <span style="{{transform-skew|40}}">∫</span>
|
∫ ∫ ∫ ∫ ∫ | |
| ||
<span style="{{transform-skew|-45}}">This skewed rightwards text{{nl}}is vertically{{nl}}aligned at bottom.</span>{{nl|3}}<span style="{{transform-skew|45}}">This skewed leftwards text{{nl}}is vertically{{nl}}aligned at bottom.</span>
|
This skewed rightwards text is vertically aligned at bottom. This skewed leftwards text is vertically aligned at bottom. | |
| ||
<div style="position: relative; top: 0px; left: 0px; {{transform-skew|-30|display = block}}">[[File:Clockface.png|200px]]</div>
|
||
| ||
<div style="position: relative; top: 0px; left: 0px; {{transform-skew|30|display = block}}">[[File:Clockface.png|200px]]</div>
|
||
| ||
<div style="position: relative; top: 0px; left: 0px; {{transform-skew|-30|-30|display = block}}">[[File:Clockface.png|200px]]</div>
|
||
| ||
<div style="position: relative; top: 0px; left: 0px; {{transform-skew|-30|30|display = block}}">[[File:Clockface.png|200px]]</div>
|
||
| ||
<div style="border: 3px solid red; width: 150px; position: relative; top: 50px; opacity: 0.5; {{transform-skew|-30|15|display = block}}">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
See also
- {{transform-translate}}
- {{transform-scale}} ({{flipX}} and {{flipY}})
- {{transform-rotate}}
- {{transform-skew}}
- {{transform}}