aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/css/clip-path
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/es/web/css/clip-path
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/es/web/css/clip-path')
-rw-r--r--files/es/web/css/clip-path/index.html179
1 files changed, 179 insertions, 0 deletions
diff --git a/files/es/web/css/clip-path/index.html b/files/es/web/css/clip-path/index.html
new file mode 100644
index 0000000000..a5c78f6eb8
--- /dev/null
+++ b/files/es/web/css/clip-path/index.html
@@ -0,0 +1,179 @@
+---
+title: clip-path
+slug: Web/CSS/clip-path
+translation_of: Web/CSS/clip-path
+---
+<div>{{CSSRef}}{{SeeCompatTable}}</div>
+
+<p>La propiedad CSS <code><strong>clip-path</strong></code> proviene que una porción de un elemento se muestre definiendo una región de recorte para mostrarse, es decir, solo una parte especifica del elemento se mostrara. La región recortada es un path especificado como una URL referenciando a un SVG inline o externo, o un metodo de figura como lo es <a href="/en-US/docs/Web/SVG/Element/circle">circle()</a>. La propiedad clip-path reemplaza la ahora deprecada propiedad <a href="/en-US/docs/Web/CSS/clip">clip</a>.</p>
+
+<pre class="brush:css no-line-numbers">/* Valores clave */
+clip-path: none;
+
+/* Valores de imagen */
+clip-path: url(resources.svg#c1);
+
+/* Valores de caja */
+clip-path: fill-box;
+clip-path: stroke-box;
+clip-path: view-box;
+clip-path: margin-box;
+clip-path: border-box;
+clip-path: padding-box;
+clip-path: content-box;
+
+/* Valores geometricos */
+clip-path: inset(100px 50px);
+clip-path: circle(50px at 0 100px);
+clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
+
+/* Valores Geometricos y de caja combinados */
+clip-path: padding-box circle(50px at 0 100px);
+
+/* Valores globales */
+clip-path: inherit;
+clip-path: initial;
+clip-path: unset;
+</pre>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<h3 id="Valores">Valores</h3>
+
+<dl>
+ <dt><code>url()</code></dt>
+ <dd>Represents a URL referencing a clip path element.</dd>
+ <dt> </dt>
+ <dt><code>inset()</code>, <code>circle()</code>, <code>ellipse()</code>, <code>polygon()</code></dt>
+ <dd>A {{cssxref("&lt;basic-shape&gt;")}} function. Such a shape will make use of the specified <code>&lt;geometry-box&gt;</code> to size and position the basic shape. If no geometry box is specified, the <code>border-box</code> will be used as reference box.</dd>
+ <dt><code>&lt;geometry-box&gt;</code></dt>
+ <dd>If specified in combination with a <code>&lt;basic-shape&gt;</code>, it provides the reference box for the basic shape. If specified by itself, it uses the edges of the specified box including any corner shaping (e.g. defined by {{cssxref("border-radius")}}) as clipping path. The geometry box can be one of the following values:
+ <dl>
+ <dt><code>fill-box</code></dt>
+ <dd>Uses the object bounding box as reference box.</dd>
+ <dt><code>stroke-box</code></dt>
+ <dd>Uses the stroke bounding box as reference box.</dd>
+ <dt><code>view-box</code></dt>
+ <dd>Uses the nearest SVG viewport as reference box. If a {{SVGAttr("viewBox")}} attribute is specified for the element creating the SVG viewport, the reference box is positioned at the origin of the coordinate system established by the <code>viewBox</code> attribute and the dimension of the reference box is set to the width and height values of the <code>viewBox</code> attribute.</dd>
+ <dt><code>margin-box</code></dt>
+ <dd>Uses the <a href="CSS_Box_Model/Introduction_to_the_CSS_box_model">margin box</a> as the reference box.</dd>
+ <dt><code>border-box</code></dt>
+ <dd>Uses the <a href="CSS_Box_Model/Introduction_to_the_CSS_box_model">border box</a> as the reference box.</dd>
+ <dt><code>padding-box</code></dt>
+ <dd>Uses the <a href="CSS_Box_Model/Introduction_to_the_CSS_box_model">padding box</a> as the reference box.</dd>
+ <dt><code>content-box</code></dt>
+ <dd>Uses the <a href="CSS_Box_Model/Introduction_to_the_CSS_box_model">content box</a> as the reference box.</dd>
+ </dl>
+ </dd>
+ <dt><code>none</code></dt>
+ <dd>There is no clipping path created.</dd>
+</dl>
+
+<h3 id="Formal_syntax">Formal syntax</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Examples">Examples</h2>
+
+<pre class="brush:css">/* inline SVG */
+.target {
+ clip-path: url(#c1);
+}
+
+/* external SVG */
+.anothertarget {
+ clip-path: url(resources.svg#c1);
+}
+
+/* circle */
+.circleClass {
+ clip-path: circle(15px at 20px 20px);
+}</pre>
+
+<h2 id="Live_sample">Live sample</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;img id="clipped" src="https://mdn.mozillademos.org/files/12668/MDN.svg"
+ alt="MDN logo"&gt;
+&lt;svg height="0" width="0"&gt;
+ &lt;defs&gt;
+ &lt;clipPath id="cross"&gt;
+ &lt;rect y="110" x="137" width="90" height="90"/&gt;
+ &lt;rect x="0" y="110" width="90" height="90"/&gt;
+ &lt;rect x="137" y="0" width="90" height="90"/&gt;
+ &lt;rect x="0" y="0" width="90" height="90"/&gt;
+ &lt;/clipPath&gt;
+ &lt;/defs&gt;
+&lt;/svg&gt;
+
+&lt;select id="clipPath"&gt;
+  &lt;option value="none"&gt;none&lt;/option&gt;
+  &lt;option value="circle(100px at 110px 100px)"&gt;circle&lt;/option&gt;
+  &lt;option value="url(#cross)" selected&gt;cross&lt;/option&gt;
+  &lt;option value="inset(20px round 20px)"&gt;inset&lt;/option&gt;
+&lt;/select&gt;
+</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">#clipped {
+ margin-bottom: 20px;
+ clip-path: url(#cross);
+}
+</pre>
+
+<div class="hidden">
+<h3 id="JavaScript">JavaScript</h3>
+
+<pre class="brush: js">var clipPathSelect = document.getElementById("clipPath");
+clipPathSelect.addEventListener("change", function (evt) {
+ document.getElementById("clipped").style.clipPath = evt.target.value;
+});
+</pre>
+</div>
+
+<h3 id="Result">Result</h3>
+
+<p>{{EmbedLiveSample("Live_sample", 230, 250)}}</p>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("CSS Masks", "#the-clip-path", 'clip-path')}}</td>
+ <td>{{Spec2('CSS Masks')}}</td>
+ <td>Extends its application to HTML elements</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('SVG1.1', 'masking.html#ClipPathProperty', 'clip-path')}}</td>
+ <td>{{Spec2('SVG1.1')}}</td>
+ <td>Initial definition (applies to SVG elements only)</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("css.properties.clip-path")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/en-US/docs/Web/SVG/Attribute/clip-rule">clip-rule</a>, {{cssxref("mask")}}, {{cssxref("filter")}}</li>
+ <li><a href="https://hacks.mozilla.org/2017/06/css-shapes-clipping-and-masking/">CSS Shapes, clipping and masking – and how to use them</a></li>
+ <li><a href="/en-US/docs/Applying_SVG_effects_to_HTML_content">Applying SVG effects to HTML content</a></li>
+ <li>{{SVGAttr("clip-path")}} SVG attribute</li>
+</ul>