--- title: background-position slug: Web/CSS/background-position tags: - CSS - 'CSS:Referencias' - Todas_las_Categorías translation_of: Web/CSS/background-position ---
{{ PreviousNext("CSS:background-image", "CSS:background-repeat") }}
background-position define la posición inicial de la imagen de fondo especificada.
background-position: [ <percentage> | <length> | left | center | right ]
[ <percentage> | <length> | top | center | bottom ] ? ;
background-position: [ top | center | bottom ];
background-position: inherit;
Si solo se especifica un valor, se entenderá que es la posición horizontal con la vertical al 50%. De otra manera el primer valor especifica la posición horizontal. Se admiten valores negativos y combinaciones de palabras claves, largos (lenght) o porcentajes, pero en el caso de mezclar las palabras claves con otros valores, 'left' y 'right' solo se utilizarán como primer valor y 'top' y 'bottom' como segundo.
.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%;
}
| Navegador | Versión mínima |
|---|---|
| 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") }}