--- title: background-position slug: Web/CSS/background-position tags: - Referencia_CSS translation_of: Web/CSS/background-position ---
{{ CSSRef() }}
background-position configura a posição inicial de qualquer imagem de fundo que seja configurada.
background-position: [ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit
Se somente um valor é especificado, então ele configura a posição horizontal, com a posição vertical em 50%. Caso contrário, o primeiro valor especifica a posição horizontal. Combinações são permitidas de valores de palavras-chave, comprimento ou porcentagens, mas se palavras-chave forem misturadas com outros valores, 'left' e 'right' podem somente ser usados como o primeiro valor, e 'top' e 'down' podem somente ser usados como o segundo valor. Posições negativas são permitidas.
.exampleone {
background-image: url("logo.png");
background-position: top center;
}
.exampletwo {
background-image: url("logo.png");
background-position: 25% 75%;
}
.examplethree {
background-image: url("logo.png");
background-position: 2cm bottom;
}
.examplefour {
background-image: url("logo.png");
background-position: center 10%;
}
.examplefive {
background-image: url("logo.png");
background-position: 2cm 50%;
}
== Notas ==
| Navegador | Versão mais antiga |
|---|---|
| Internet Explorer | 4 |
| Firefox | 1 |
| Netscape | 6 |
| 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-position", "fr": "fr/CSS/background-position", "pl": "pl/CSS/background-position" } ) }}