mozilla

Revision 185909 of background

  • Slug da revisão: CSS/background
  • Título da revisão: background
  • ID da revisão: 185909
  • Criado:
  • Autor: Luis Henrique Sousa
  • É revisão atual? Não
  • Comentário /* Exemplos */
Etiquetas: 

Conteúdo da revisão

{{template.CSSRef()}}

Resumo

The background property is a shorthand property for setting the individual background property values in a single place in the style sheet. background can be used to set the values for one or more of: {{template.Cssxref("background-attachment")}}, {{template.Cssxref("background-color")}}, {{template.Cssxref("background-image")}}, {{template.Cssxref("background-position")}}, {{template.Cssxref("background-repeat")}}.

  • Valor inicial: see individual properties for details
  • Aplica-se a: all elements
  • Herança: no
  • Porcentagens: allowed on {{template.Cssxref("background-position")}}
  • Mídia: visual
  • Valor computado: see individual properties

Sintaxe

background: [background-color || background-image ||
    background-repeat || background-attachment ||
    background-position] | inherit]

Valores

background-color
Veja background-color.
background-image 
Veja background-image.
background-repeat 
Veja background-repeat.
background-attachment 
Veja background-attachment.
background-position 
Veja background-position.

Exemplos

Veja alguns exemplos.

body { 
    background: red;
}

.topbanner {
    background: url("topbanner.png") #00D repeat fixed;
}

Notas

Given a valid declaration, the background property first sets the individual background properties to their initial values, then assigns the explicit values specified in the declaration. You do not have to define a value for each of the individual properties, only those you want to change from their initial defaults.

Especificações

Compatibilidade com navegadores

Navegador Versão mais antiga
Internet Explorer 4
Firefox 1
Netscape 6
Opera 3.5

Veja também

{{template.Cssxref("background")}}, {{template.Cssxref("background-attachment")}}, {{template.Cssxref("background-color")}}, {{template.Cssxref("background-image")}}, {{template.Cssxref("background-position")}}, {{template.Cssxref("background-repeat")}}


Categorias

Interwiki Language Links

{{ wiki.languages( { "en": "en/CSS/background", "fr": "fr/CSS/background", "pl": "pl/CSS/background" } ) }}

Fonte da revisão

<p>
{{template.CSSRef()}}
</p>
<h3 name="Resumo"> Resumo </h3>
<p>The <code>background</code> property is a shorthand property for setting the individual background property values in a single place in the style sheet.  <code>background</code> can be used to set the values for one or more of: {{template.Cssxref("background-attachment")}}, {{template.Cssxref("background-color")}}, {{template.Cssxref("background-image")}}, {{template.Cssxref("background-position")}}, {{template.Cssxref("background-repeat")}}.
</p>
<ul><li> Valor inicial: see individual properties for details
</li><li> Aplica-se a: all elements
</li><li> Herança: no
</li><li> Porcentagens: allowed on {{template.Cssxref("background-position")}}
</li><li> Mídia: <a href="pt/CSS/Media/Visual">visual</a>
</li><li> Valor computado: see individual properties
</li></ul>
<h3 name="Sintaxe"> Sintaxe </h3>
<pre class="eval">background: [<i>background-color</i> || <i>background-image</i> ||
    <i>background-repeat</i> || <i>background-attachment</i> ||
    <i>background-position</i>] | <i>inherit</i>]
</pre>
<h3 name="Valores"> Valores </h3>
<dl><dt> background-color</dt><dd> Veja <code><a href="pt/CSS/background-color">background-color</a></code>.
</dd><dt> background-image </dt><dd> Veja <code><a href="pt/CSS/background-image">background-image</a></code>.
</dd><dt> background-repeat </dt><dd> Veja <code><a href="pt/CSS/background-repeat">background-repeat</a></code>.
</dd><dt> background-attachment </dt><dd> Veja <code><a href="pt/CSS/background-attachment">background-attachment</a></code>.
</dd><dt> background-position </dt><dd> Veja <code><a href="pt/CSS/background-position">background-position</a></code>.
</dd></dl>
<h3 name="Exemplos"> Exemplos </h3>
<p><a class="external" href="http://developer.mozilla.org/samples/cssref/background.html">Veja alguns exemplos</a>. 
</p>
<pre>body { 
    background: red;
}

.topbanner {
    background: url("topbanner.png") #00D repeat fixed;
}
</pre>
<h3 name="Notas"> Notas </h3>
<p>Given a valid declaration, the <code>background</code> property first sets the individual background properties to their initial values, then assigns the explicit values specified in the declaration.  You do not have to define a value for each of the individual properties, only those you want to change from their initial defaults.
</p>
<h3 name="Especifica.C3.A7.C3.B5es"> Especificações </h3>
<ul><li> <a class="external" href="http://www.w3.org/TR/CSS1#background">CSS 1</a>
</li><li> <a class="external" href="http://www.w3.org/TR/CSS21/colors.html#propdef-background">CSS 2.1</a>
</li><li> <a class="external" href="http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-background">CSS 3</a>
</li></ul>
<h3 name="Compatibilidade_com_navegadores"> Compatibilidade com navegadores </h3>
<table class="standard-table">
  <tbody><tr>
    <th>Navegador</th>
    <th>Versão mais antiga</th>
  </tr>
  <tr>
    <td>Internet Explorer</td>
    <td>4</td>
  </tr>
  <tr>
    <td>Firefox</td>
    <td>1</td>
  </tr>
  <tr>
    <td>Netscape</td>
    <td>6</td>
  </tr>
  <tr>
    <td>Opera</td>
    <td>3.5</td>
  </tr>
</tbody></table>
<h3 name="Veja_tamb.C3.A9m"> Veja também </h3>
<p>{{template.Cssxref("background")}}, 
{{template.Cssxref("background-attachment")}}, 
{{template.Cssxref("background-color")}}, 
{{template.Cssxref("background-image")}}, 
{{template.Cssxref("background-position")}}, 
{{template.Cssxref("background-repeat")}}
</p><p><br>
<span class="comment">Categorias</span>
</p><p><span class="comment">Interwiki Language Links</span>
</p>{{ wiki.languages( { "en": "en/CSS/background", "fr": "fr/CSS/background", "pl": "pl/CSS/background" } ) }}
Reverter para esta revisão