From 1109132f09d75da9a28b649c7677bb6ce07c40c0 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:45 -0500 Subject: initial commit --- files/es/web/css/background/index.html | 138 +++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 files/es/web/css/background/index.html (limited to 'files/es/web/css/background') diff --git a/files/es/web/css/background/index.html b/files/es/web/css/background/index.html new file mode 100644 index 0000000000..d982708096 --- /dev/null +++ b/files/es/web/css/background/index.html @@ -0,0 +1,138 @@ +--- +title: background +slug: Web/CSS/background +tags: + - CSS + - 'CSS:Referencias' + - Todas_las_Categorías +translation_of: Web/CSS/background +--- +

{{CSSRef}}

+ +

La propiedad background es un atajo para definir los valores individuales del fondo en una única regla CSS. Se puede usar background para definir los valores de una o de todas las propiedades siguientes: {{ Cssxref("background-attachment") }}, {{ Cssxref("background-color", "color") }}, {{ Cssxref("background-image", "image") }}, {{ Cssxref("background-position", "position") }}, {{ Cssxref("background-repeat", "repeat") }}.

+ + + +

Sintaxis

+ +
/* Usando <background-color> */
+background: green;
+
+/* Usando <bg-image> y <repeat-style> */
+background: url("test.jpg") repeat-y;
+
+/* Usando <box> and <background-color> */
+background: border-box red;
+
+/* Una sola imagen, centrada y escalada */
+background: no-repeat center/80% url("../img/image.png");
+ +

La propiedad  background se especifica como una o más capas de fondo, separadas por comas.

+ +

La sintaxis de cada capa es la siguiente:

+ + + +

Valores

+ +
+
background-color
+
ver color.
+
background-image 
+
ver image.
+
background-repeat 
+
ver repeat.
+
background-attachment 
+
ver background-attachment.
+
background-position 
+
ver position.
+
+ +

Ejemplos

+ +

HTML

+ +
<p class="topbanner">
+  Starry sky<br/>
+  Twinkle twinkle<br/>
+  Starry sky
+</p>
+<p class="warning">Here is a paragraph<p>
+ +

CSS

+ +
.warning {
+  background: red;
+}
+
+.topbanner {
+  background: url("https://mdn.mozillademos.org/files/11983/starsolid.gif") #00D repeat-y fixed;
+}
+
+ +

Result

+ +

{{EmbedLiveSample("Ejemplos")}}

+ +

Notas

+ +

Tomando una declaración válida, la propiedad background inicia las propiedades individuales a sus valores iniciales para después asignarles los valores especificadas explícitamente en la declaración. No hay que definir un valor por cada propiedad individual, se cambia solo las que necesitamos en relación al valor por defecto.

+ +

Especificaciones

+ + + +

Compatibilidad de navegadores

+ + + + + + + + + + + + + + + + + + + + + + + + +
NavegadorMínima versión
Internet Explorer4
Firefox1
Netscape6
Opera3.5
+ +

Ver también

+ +

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

-- cgit v1.2.3-54-g00ecf