Template:Background: Difference between revisions

From BoyWiki
No edit summary
No edit summary
Tag: Manual revert
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
{{#if:{{{image|}}}
{{#if:{{{image|}}}
   |<div class="mdlfond {{{image}}}" {{#if:{{{taille|}}}|style="background-size:{{{taille}}};"}}>
   |<div class="bg {{{image}}}" {{#if:{{{size|}}}|style="background-size:{{{size}}};"}}>
{{#if:{{{opacité|}}}|<div style="background-color:rgba(255,255,255,{{{opacité}}}); margin:{{#expr:{{{marge|0}}}-8}}px; padding:8px;">}}
{{#if:{{{transparency|}}}|<div style="background-color:rgba(255,255,255,{{{transparency}}}); margin:{{#expr:{{{marge|0}}}-8}}px; padding:8px;">}}
   |<div class="mdlfond">
   |<div class="bg">
}}
}}
{{#if:{{{couleur|}}}
{{#if:{{{color|}}}
   | <div class="mdlfond" style="background-color:{{{couleur}}}; padding:{{{marge|8}}}px;">
   | <div class="bg" style="background-color:{{{color}}}; padding:{{{marge|8}}}px;">
}}
}}
{{#if:{{{dégradé|}}}
{{#if:{{{gradient|}}}
   | {{#switch:{{{dégradé}}}
   | {{#switch:{{{gradient}}}
     |linéaire|linear|lin=<div class="mdlfond" style="background:-moz-linear-gradient({{{a|0}}}deg,{{{c1|#789}}},{{{c2|#DEF}}}); background-image:linear-gradient({{{a|0}}}deg,{{{c1|#789}}},{{{c2|#DEF}}}); padding:{{{marge|8}}}px;">
     |linear|linear|lin=<div class="bg" style="background:-moz-linear-gradient({{{a|0}}}deg,{{{c1|#789}}},{{{c2|#DEF}}}); background-image:linear-gradient({{{a|0}}}deg,{{{c1|#789}}},{{{c2|#DEF}}}); padding:{{{marge|8}}}px;">
     |radial|rad=<div class="mdlfond" style="background:-moz-radial-gradient({{{c1|#789}}},{{{c2|#DEF}}});background-image:radial-gradient({{{c1|#789}}},{{{c2|#DEF}}}); padding:{{{marge|8}}}px;">
     |radial|rad=<div class="bg" style="background:-moz-radial-gradient({{{c1|#789}}},{{{c2|#DEF}}});background-image:radial-gradient({{{c1|#789}}},{{{c2|#DEF}}}); padding:{{{marge|8}}}px;">
     }}
     }}
}}{{{1|texte}}}{{#if:{{{opacité|}}}|</div>}}</div></includeonly><noinclude>
}}{{{1|text}}}{{#if:{{{transparency|}}}|</div>}}</div></includeonly><noinclude>
;Utilisation :
{{documentation}}
Affiche un fond derrière le contenu. Ce fond peut être une image, une couleur unie, ou un dégradé à deux couleurs.
[[Category:General wiki templates]]
;Syntaxe :
<pre><nowiki>{{Fond [|image= [|opacité=] [|taille=]] [|marge=]
      [|couleur=] [|dégradé= [|a=] |c1= |c2=]] | Contenu}}</nowiki></pre>
;Paramètres :
L'un seulement des paramètres ''image'', ''couleur'' ou ''dégradé'' doit être indiqué. Les paramètres ''a'', ''c1'' et ''c2'' ne sont utiles que si ''dégradé'' est choisi. Le paramètre ''opacité'' n'est utile que si ''image'' est choisi.
*image= : nom du style faisant lien vers l'image (optionnel). Une image ne peut être appelée directement pour s'afficher en fond. Il est nécessaire de passer par une classe de style portant le nom de l'image (sans espace ni extension de fichier).
*couleur= : nom ou notation de couleur (optionnel). Certaines couleurs portent un nom comme ''grey'' ou ''lightblue''. Toutes les couleurs peuvent être représentées par une notation hexadécimale de la forme #RVB ou #RRVVBB (ne pas oublier #).
*dégradé= : type linéaire ou radial (optionnel)
:*a= : angle entre 0 et 360 (optionnel) seulement pour dégradé linéaire. Sens du dégradé (0=G->D,90=B->H,180=D->G,270=H->B)
:*c1= : couleur 1 du dégradé (optionnel)
:*c2= : couleur 2 du dégradé (optionnel)
*opacité : transparence de l'image (optionnel) seulement pour image. Valeur relative entre 0 et 1.
*taille= : dimension de l'image (optionnel) seulement pour image. Valeur en % (préférable) ou en px.
*marge : espace autour du contenu (optionnel) valeur en pixels (ne pas indiquer px)
;Exemples :
<pre><nowiki>{{Background |couleur=yellow |marge=10 | Contenu}}</nowiki></pre>
donne
{{Background |couleur=yellow |marge=10 | Contenu}}
:
<pre><nowiki>{{Background |dégradé=linéaire |a=90 |c1=blue |c2=lightblue |marge=50 | Contenu}}</nowiki></pre>
donne
{{Background |dégradé=linéaire |a=90 |c1=blue |c2=lightblue |marge=50 | Contenu}}
:
<pre><nowiki>{{Background |dégradé=radial |c1=green |c2=lightgreen |marge=20 | Contenu}}</nowiki></pre>
donne
{{Background |dégradé=radial |c1=green |c2=lightgreen |marge=20 | Contenu}}
:
<pre><nowiki>{{Background |image=ANSHUTZ_Thomas_Pollock_1894c_Boys_playing_with_crabs_1025x607 |opacité=0.7 |marge=80 |taille=100% | Contenu}}</nowiki></pre>
donne
{{Background|image=ANSHUTZ_Thomas_Pollock_1894c_Boys_playing_with_crabs_1025x607 |opacité=0.7 |marge=80 |taille=100% | Contenu}}

Latest revision as of 20:32, 11 December 2021


BoyWiki Template documentation (for the above template, sometimes hidden or invisible)
Utilisation

Use displays a background behind the content. This background can be an image, a solid color or a gradient to two colors.

Syntaxe
{{Background [|image= [|transparency=] [|size=]] [|marge=]
       [|color=] [|gradient= [|a=] |c1= |c2=]] | text}}
Parameters

Help:Hex codes

Only one of the image settings, color or gradient should be indicated. The parameters a, c1 and c2 are useful only if gradient is selected. The opacity parameter is useful only if image is selected. Image =: name of the style that link to the image (optional). An image can be called directly to display in the background. It is necessary to go through a style class with the name of the image (without space and file extension).

  • color =: name or notation of color (optional). Some colors are named as "grey" or "lightblue". All colors can be represented by a hexadecimal notation of the form #RVB or #RRVVBB (don't forget #).
  • gradient =: linear or radial type (optional)
* a =: angle between 0 and 360 (optional) for linear gradient only. Direction of the gradient (0 = G-> D, 90 = B-> H, 180 = D-> G, 270 = H-> B)
* c1 =: color 1 (optional) gradient
* c2 =: 2 (optional) gradient color
  • transparency: transparency of the image (optional) only for image. Relative value between 0 and 1.
  • size =: (optional) image only for image size.Value in % (preferable) or px.
  • margin: space around the content (optional) value in pixels (do not indicate px)
Exemples
{{Background |color=yellow |marge=10 | text}}

gives

text
{{Background |gradient=linear |a=90 |c1=blue |c2=lightblue |marge=50 | text}}

gives

text
{{Background |gradient=radial |c1=green |c2=lightgreen |marge=20 |1= text}}

gives

text
{{Background |image=back13|size=100% |1=}}

gives

text



Visit Template:Background/doc to edit this template's description!
Done making changes?   Refresh   Also see:  Portal:Template index  and   Help:Templates