--- title: background-clip slug: Web/CSS/background-clip tags: - CSS - Diseño - Fondo CSS - Propiedad CSS - Referencia - Referência(2) - Web translation_of: Web/CSS/background-clip ---
La propiedad CSS background-clip especifica si el fondo de un elemento, ya sea el color o imagen, se extiende por debajo su borde.
Si la imagen o color de fondo no esta definido, esta propiedad solo tendrá un efecto visual cuando el borde tenga regiones transparentes o regiones parcialmente opacas (debido a {{ Cssxref("border-style") }} o {{ Cssxref("border-image") }}); de lo contrario el borde cubre la diferencia.
{{cssinfo}}
Sintaxis Formal: {{csssyntax("background-clip")}}
background-clip: border-box background-clip: padding-box background-clip: content-box background-clip: inherit
border-boxpadding-boxcontent-box<p class="border-box">The yellow background extends behind the border.</p> <p class="padding-box">The yellow background extends to the inside edge of the border.</p> <p class="content-box">The yellow background extends only to the edge of the content box.</p>
p {
border: 5px navy;
border-style: dotted double;
margin: 2em;
padding: 2em;
background: #F8D575;
}
.border-box { background-clip: border-box; }
.padding-box { background-clip: padding-box; }
.content-box { background-clip: content-box; }
{{ EmbedLiveSample('Ejemplo', 540, 450) }}
| Especificación | Estado | Comentario |
|---|---|---|
| {{ SpecName('CSS3 Backgrounds', '#the-background-clip', 'background-clip') }} | {{ Spec2('CSS3 Backgrounds') }} |