mozilla

Revision 395965 of -moz-image-region

  • Revision slug: Web/CSS/-moz-image-region
  • Revision title: -moz-image-region
  • Revision id: 395965
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment CSS/-moz-image-region Web/CSS/-moz-image-region

Revision Content

{{ CSSMozExtensionRef() }}

Summary

For certain XUL elements and pseudo-elements that use an image from the {{ Cssxref("list-style-image") }} property, this property specifies a region of the image that is used in place of the whole image. This allows elements to use different pieces of the same image to improve performance.

The syntax is similar to the {{ Cssxref("clip") }} property. All four values are relative to the upper left corner of the image.

  • {{ Xref_cssinitial() }} {{ Cssxref("auto") }}
  • Applies to XUL {{ XULElem("image") }} elements and {{ Cssxref(":-moz-tree-image") }}, {{ Cssxref(":-moz-tree-twisty") }}, and {{ Cssxref(":-moz-tree-checkbox") }} pseudo-elements
  • {{ Xref_cssinherited() }} yes
  • Percentages n/a
  • Media {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }} For rect() values, a rect consisting of four computed lengths; otherwise as specified.

Syntax

-moz-image-region: rect(top, right, bottom, left);

Examples

#example-button {
  /* display only the 4x4 area from the top left of this image */
  list-style-image: url("chrome://example/skin/example.png");
  -moz-image-region: rect(0px, 4px, 4px, 0px);
}
#example-button:hover {
  /* use the 4x4 area to the right of the first for the hovered button */
  -moz-image-region: rect(0px, 8px, 4px, 4px);
}

Revision Source

<div>{{ CSSMozExtensionRef() }}</div>

<h2 id="Summary" name="Summary">Summary</h2>

<p>For certain XUL elements and pseudo-elements that use an image from the {{ Cssxref("list-style-image") }} property, this property specifies a region of the image that is used in place of the whole image. This allows elements to use different pieces of the same image to improve performance.</p>

<p>The syntax is similar to the {{ Cssxref("clip") }} property. All four values are relative to the upper left corner of the image.</p>

<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}</dfn> {{ Cssxref("auto") }}</li>
  <li><dfn>Applies to</dfn> XUL {{ XULElem("image") }} elements and {{ Cssxref(":-moz-tree-image") }}, {{ Cssxref(":-moz-tree-twisty") }}, and {{ Cssxref(":-moz-tree-checkbox") }} pseudo-elements</li>
  <li><dfn>{{ Xref_cssinherited() }}</dfn> yes</li>
  <li><dfn>Percentages</dfn> n/a</li>
  <li><dfn>Media</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}</dfn> For <code>rect()</code> values, a rect consisting of four computed lengths; otherwise as specified.</li>
</ul>

<h2 id="Syntax" name="Syntax">Syntax</h2>

<pre class="syntaxbox">-moz-image-region: rect(<em>top</em>, <em>right</em>, <em>bottom</em>, <em>left</em>);</pre>

<h2 id="Examples" name="Examples">Examples</h2>

<pre class="brush:css">
#example-button {
  /* display only the 4x4 area from the top left of this image */
  list-style-image: url("chrome://example/skin/example.png");
  -moz-image-region: rect(0px, 4px, 4px, 0px);
}
#example-button:hover {
  /* use the 4x4 area to the right of the first for the hovered button */
  -moz-image-region: rect(0px, 8px, 4px, 4px);
}</pre>
Revert to this revision