Predloga:Linear-gradient/dok
| To je dokumentacijska podstran za glavno stran Predloga:Linear-gradient. Namenjena je shranjevanju navodil, kategorizaciji in drugi vsebini, ki ni del glavne strani. |
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.
<div style="{{linear-gradient | start position | #color [stop], #color [stop][, #color [stop], ...] }}">Lorem ipsum...</div>
start position– Mandatory. Specify a start point:left,top,rightorbottom, or a combination of two of each, e.g.top left. This provides eight starting points.color– The first two colors are mandatory. You can define any number of additional colors, separated with commas.stop– Optional. You can specify a stop position for each color using a percentage (e.g. 45%) or pixels (e.g. 60px).
Technical notes
Unlike {{gradient}}, this template does not assign a default background-color, and therefor 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. This allows for much more flexibility in design and fallback handling in unsupported browsers.
This template uses the new CSS3 properties for linear gradients: -moz-linear-gradient, -ms-linear-gradient, -o-linear-gradient, -webkit-linear-gradient and linear-gradient It does not use the legacy -webkit-gradient property due to its deviating parameter format. This means that this template does not work in Safari versions below 5.1 and Google Chrome versions below 10.
Examples
<div style="{{linear-gradient|left|#ffdddd, #ddddff}}">Lorem ipsum...</div>will produce
<div style="{{linear-gradient|left|#ffdddd, #ddffdd 50%, #ddddff}}">Lorem ipsum...</div>will produce
<div style="{{linear-gradient|top|#ffdddd, #ddddff}}">Lorem ipsum...</div>will produce
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.
Compatibility
- See linear-gradient on the Mozilla Developer Network for all broswer compatibility details.
See also
- {{radial-gradient}}
- {{border-radius}}
- {{box-shadow}}
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.









