1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
---
title: clip
slug: Web/CSS/clip
translation_of: Web/CSS/clip
---
<div>{{CSSRef}}{{deprecated_header}}</div>
<h2 id="總結">總結</h2>
<p><strong><code>這個 clip</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a> 屬性用來定義元素的哪一個部分是可見的. <code>clip</code> 屬性只能被賦予在絕對位置的元素(element)上, 像是帶有這些的CSS屬性的元素 {{cssxref("position","position:absolute")}} or {{cssxref("position","position:fixed")}}.</p>
<div class="warning">
<p><strong>警告:</strong> 這個屬性被遺棄了. 請改用 {{cssxref("clip-path")}} .</p>
</div>
<p>{{cssinfo}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="brush: css">/* Keyword value */
clip: auto;
/* <shape> values */
clip: rect(1px 10em 3rem 2ch);
clip: rect(1px, 10em, 3rem, 2ch);
/* Global values */
clip: inherit;
clip: initial;
clip: unset;
</pre>
<h3 id="Values">Values</h3>
<dl>
<dt><code><shape></code></dt>
<dd>A rectangular {{cssxref("<shape>")}} of the form <code>rect(<top>, <right>, <bottom>, <left>)</code> or of the form <code>rect(<top> <right> <bottom> <left>)</code> (which is a more backwards compatible syntax) <code><top></code> and <code><bottom></code> specify offsets from the <em>inside top border edge</em> of the box, and <code><right></code>, and <code><left></code> specify offsets from the <em>inside left border edge</em> of the box — that is, the extent of the padding box.</dd>
<dd><code><top></code>, <code><right></code>, <code><bottom></code>, and <code><left></code> may either have a {{cssxref("<length>")}} value or<code> auto</code>. If any side's value is <code>auto</code>, the element is clipped to that side's <em>inside border edge</em>.</dd>
<dt><code>auto</code></dt>
<dd>The element does not clip (default value). Note that this is distinct from <code>rect(auto, auto, auto, auto)</code>, which does clip to the inside border edges of the element.</dd>
</dl>
<h3 id="Formal_syntax">Formal syntax</h3>
{{csssyntax}}
<h2 id="Examples">Examples</h2>
<pre class="brush:css">.dotted-border {
border: dotted;
position: relative;
width: 536px;
height: 350px;
}
#top-left, #middle, #bottom-right {
position: absolute;
top: 0px;
}
#top-left {
left: 360px;
clip: rect(0px, 175px, 113px, 0px);
}
#middle {
left: 280px;
clip: rect(119px, 255px, 229px, 80px);
/* standard syntax, unsupported by Internet Explorer 4-7 */
}
#bottom-right {
left: 200px;
clip: rect(235px 335px 345px 160px);
/* non-standard syntax, but supported by all major browsers*/
}</pre>
<pre class="brush:html"><p class="dotted-border">
<img src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Original Graphic" />
<img id="top-left" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped to upper left">
<img id="middle" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped towards middle">
<img id="bottom-right" src="https://developer.mozilla.org/@api/deki/files/3613/=hut.jpg" title="Graphic clipped to bottom right">
</p></pre>
<p>{{EmbedLiveSample('Examples', '689px', '410px')}}</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', '#clip-property', 'clip')}}</td>
<td>{{Spec2('CSS Masks')}}</td>
<td>Deprecates <code>clip</code> property, suggests {{cssxref("clip-path")}} as replacement.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Transitions', '#animatable-css', 'clip')}}</td>
<td>{{Spec2('CSS3 Transitions')}}</td>
<td>Defines <code>clip</code> as animatable.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'visufx.html#clipping', 'clip')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_Compatibility" name="Browser_Compatibility">Browser compatibility</h2>
{{Compat("css.properties.clip")}}
<h2 id="See_also">See also</h2>
<ul>
<li>Related CSS properties: {{cssxref("text-overflow")}}, {{cssxref("white-space")}}, {{Cssxref("overflow-x")}}, {{Cssxref("overflow-y")}}, {{Cssxref("overflow")}}, {{Cssxref("display")}}, {{Cssxref("position")}}</li>
</ul>
|