--- title: background-image slug: Web/CSS/background-image tags: - CSS_1 - CSS_2.1 - CSS_3 - Referencia_CSS translation_of: Web/CSS/background-image ---
{{ CSSRef() }}
A propriedade background-image
configura a imagem de fundo para um elemento.
background-image:uri | none | inherit
Note that the star image is partially transparent and is layered over the cat image.
<div> <p class="catsandstars"> This paragraph is full of cats<br />and stars. </p> <p>This paragraph is not.</p> <p class="catsandstars"> Here are more cats for you.<br />Look at them! </p> <p>And no more.</p> </div>
pre, p { font-size: 1.5em; color: #FE7F88; background-color: transparent; } div { background-image: url("https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png"); } p { background-image: none; } .catsandstars { background-image: url("https://mdn.mozillademos.org/files/11991/startransparent.gif"), url("https://mdn.mozillademos.org/files/7693/catfront.png"); background-color: transparent; }
{{EmbedLiveSample('Exemplos')}}
Desenvolvedores devem assegurar-se de especificar um {{ Cssxref("background-color") }} para ser usado se uma imagem não estiver disponível. Imagens de fundo são renderizadas sobre a cor de fundo.
Navegador | Versão mais antiga |
---|---|
Internet Explorer | 4 |
Firefox | 1 |
Netscape | 4 |
Opera | 3.5 |
{{ Cssxref("background") }}, {{ Cssxref("background-attachment") }}, {{ Cssxref("background-color") }}, {{ Cssxref("background-image") }}, {{ Cssxref("background-position") }}, {{ Cssxref("background-repeat") }}
Categorias
Interwiki Language Links
{{ languages( { "en": "en/CSS/background-image", "fr": "fr/CSS/background-image", "pl": "pl/CSS/background-image" } ) }}