aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web/svg/attribute/stroke-dashoffset/index.html
blob: e8a076e3525d15fe41ada49c529c823531766eb3 (plain)
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
---
title: stroke-dashoffset
slug: Web/SVG/Attribute/stroke-dashoffset
tags:
  - 可縮放矢量圖形
  - 可縮放矢量圖形 屬性
translation_of: Web/SVG/Attribute/stroke-dashoffset
---
<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG 屬性引用首頁</a></p>

<p><code>stroke-dashoffset</code> 屬性指定一個數值至虛線的開頭。</p>

<p>如果使用 <a href="/en/SVG/Content_type#Percentage" title="en/SVG/Content_type#Percentage">&lt;percentage&gt;</a> ,值則會代表當前viewport的百分比。<br>
 <br>
 值允許為負值。</p>

<h2 id="Usage_context">Usage context</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">類別</th>
   <td>Presentation attribute</td>
  </tr>
  <tr>
   <th scope="row">可用值</th>
   <td><a href="/en/SVG/Content_type#Percentage" title="en/SVG/Content_type#Percentage">&lt;percentage&gt;</a> | <a href="/en/SVG/Content_type#Length" title="en/SVG/Content_type#Length"><span>&lt;length&gt;</span></a> | inherit</td>
  </tr>
  <tr>
   <th scope="row">初始值</th>
   <td>0</td>
  </tr>
  <tr>
   <th scope="row">可動畫化</th>
   <td></td>
  </tr>
  <tr>
   <th scope="row">規範文件</th>
   <td><a class="external" href="http://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty" title="http://www.w3.org/TR/SVG11/painting.html#StrokeDashoffsetProperty">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="範例" name="範例">範例</h2>

<h3 id="HTML_內容">HTML 內容</h3>

<pre class="brush: html">&lt;svg width="200" height="200" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg"&gt;
    &lt;line stroke-dashoffset="0" stroke-dasharray="20" x1="0" y1="10" x2="200" y2="10"/&gt;
    &lt;line stroke-dashoffset="10" stroke-dasharray="20" x1="0" y1="20" x2="200" y2="20"/&gt;
    &lt;line stroke-dashoffset="20" stroke-dasharray="20" x1="0" y1="30" x2="200" y2="30"/&gt;
    &lt;line stroke-dashoffset="50%" stroke-dasharray="20" x1="0" y1="40" x2="200" y2="40"/&gt;
    &lt;line stroke-dashoffset="25%" stroke-dasharray="20" x1="0" y1="50" x2="200" y2="50"/&gt;
    &lt;line stroke-dashoffset="0%" stroke-dasharray="20" x1="0" y1="60" x2="200" y2="60"/&gt;
&lt;/svg&gt;</pre>

<h3 id="CSS_內容">CSS 內容</h3>

<pre class="brush: css">line{
    stroke: #51BBA7;
    stroke-width: 2;
}</pre>

<h3 id="結果">結果</h3>

<p>{{ EmbedLiveSample('範例') }}</p>

<h2 id="適用元素">適用元素</h2>

<p>以下元素可以使用 <code>stroke-dashoffset</code> 屬性</p>

<ul>
 <li><a href="/en/SVG/Element#Shape" title="en/SVG/Element#Shape">Shape elements</a> »</li>
 <li><a href="/en/SVG/Element#TextContent" title="en/SVG/Element#TextContent">Text content elements</a> »</li>
</ul>