Template:Linear-gradient/doc: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(H2)
Line 4: Line 4:
This template creates a gradient background. This currently works in Firefox (3.6 and up), Opera (11.10 and up), Safari (5.1 and up), Google Chrome (10 and up) and Internet Explorer 10.
This template creates a gradient background. This currently works in Firefox (3.6 and up), Opera (11.10 and up), Safari (5.1 and up), Google Chrome (10 and up) and Internet Explorer 10.


=== Usage ===
== Usage ==


Use within a CSS style tag. The template uses the <tt>background-image</tt> property. Unlike {{tl|gradient}, it does not provide an automatic fallback for browsers that do not support gradients. To provide a fallback, always specify a background color ''in front'' of the template.
Use within a CSS style tag. The template uses the <tt>background-image</tt> property. Unlike {{tl|gradient}, it does not provide an automatic fallback for browsers that do not support gradients. To provide a fallback, always specify a background color ''in front'' of the template.
Line 14: Line 14:
#<tt>stop</tt> – Optional. You can specify a stop position for each color using a percentage (e.g. 45%) or pixels (e.g. 60px).
#<tt>stop</tt> – Optional. You can specify a stop position for each color using a percentage (e.g. 45%) or pixels (e.g. 60px).


=== Examples ===
== Examples ==


{{see also|Template:Linear-gradient/testcases}}
{{see also|Template:Linear-gradient/testcases}}
Line 30: Line 30:
<div style="{{linear-gradient|top|#ffdddd, #ddddff}}">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div style="{{linear-gradient|top|#ffdddd, #ddddff}}">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>


=== Technical notes ===
== Technical notes ==


This template uses the new CSS3 properties for linear gradients: <tt>-moz-linear-gradient</tt>, <tt>-ms-linear-gradient</tt>, <tt>-o-linear-gradient</tt> and <tt>-webkit-linear-gradient</tt>. It no longer use the legacy <tt>-webkit-gradient</tt> property due to it's deviating parameter format. This means that this template does not work in Safari versions below 5.1 and Google Chrome versions below 10.
This template uses the new CSS3 properties for linear gradients: <tt>-moz-linear-gradient</tt>, <tt>-ms-linear-gradient</tt>, <tt>-o-linear-gradient</tt> and <tt>-webkit-linear-gradient</tt>. It no longer use the legacy <tt>-webkit-gradient</tt> property due to it's deviating parameter format. This means that this template does not work in Safari versions below 5.1 and Google Chrome versions below 10.


=== Considerations ===
== Considerations ==


Above examples use contrasting colors to show the effect more clearly. It is best to use subtle differences in color to enhance the appearance, rather than radically change it. This also minimizes the effects between browsers that do and do not support gradients.
Above examples use contrasting colors to show the effect more clearly. It is best to use subtle differences in color to enhance the appearance, rather than radically change it. This also minimizes the effects between browsers that do and do not support gradients.


=== See also ===
== See also ==


* {{tl|border-radius}}
* {{tl|border-radius}}

Revision as of 12:41, 11 January 2012


This template creates a gradient background. This currently works in Firefox (3.6 and up), Opera (11.10 and up), Safari (5.1 and up), Google Chrome (10 and up) and Internet Explorer 10.

Usage

Use within a CSS style tag. The template uses the background-image property. Unlike {{tl|gradient}, it does not provide an automatic fallback for browsers that do not support gradients. To provide a fallback, always specify a background color in front of the template.

<div style="{{linear-gradient | start position | #color [stop], #color [stop][, #color [stop], ...] }}">Lorem ipsum...</div>

  1. start position – Mandatrory. Specify a start point: left, top, right or bottom, or a combination of two of each, e.g. top left. This provides eight starting points.
  2. color – The first two colors are mandatory. You can define any number of additional colors, separated with commas.
  3. stop – Optional. You can specify a stop position for each color using a percentage (e.g. 45%) or pixels (e.g. 60px).

Examples

  • <div style="{{linear-gradient|left|#ffdddd, #ddddff}">Lorem ipsum...</div> will produce
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • <div style="{{linear-gradient|left|#ffdddd, #ddffdd 50%, #ddddff}}">Lorem ipsum...</div> will produce
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  • <div style="{{linear-gradient|top|#ffdddd, #ddddff}}">Lorem ipsum...</div> will produce
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Technical notes

This template uses the new CSS3 properties for linear gradients: -moz-linear-gradient, -ms-linear-gradient, -o-linear-gradient and -webkit-linear-gradient. It no longer use the legacy -webkit-gradient property due to it's deviating parameter format. This means that this template does not work in Safari versions below 5.1 and Google Chrome versions below 10.

Considerations

Above examples use contrasting colors to show the effect more clearly. It is best to use subtle differences in color to enhance the appearance, rather than radically change it. This also minimizes the effects between browsers that do and do not support gradients.

See also