Jump to content

Àdàkọ:Gradient/doc

Lát'ọwọ́ Wikipedia, ìwé ìmọ̀ ọ̀fẹ́

This template creates a gradient background. This currently works in Firefox (3.6 and up), Safari (4.0 and up) and Google Chrome. In other browsers, it only displays the start color as background color.

Use within a CSS style tag. The template uses the background-color and background-image properties, so best practice is to place it behind any other background properties.

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

  1. start color - Mandatory. The start color of the gradient in CSS notation.
  2. end color - Mandatory. The end color of the gradient in CSS notation.
  3. orientation - Optional. horizontal (default) or vertical.
  4. stop color - Optional. Intermediate color between the start and end color.
  5. stop position - Optional. Position of the stop color between 0% and 100%. Default is 50%.

Each parameter must be placed in their respective position.


  • <div style="{{gradient|#ffdddd|#ddddff|horizontal}}">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="{{gradient|#ffdddd|#ddddff|horizontal|#ddffdd|50%}}">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="{{gradient|#ffdddd|#ddddff|vertical}}">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.

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.