aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/marker-start/index.html
blob: 23b5ea6d6d796e60f156d88c5f3e12c2537e6751 (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
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
---
title: marker-start
slug: Web/SVG/Attribute/marker-start
translation_of: Web/SVG/Attribute/marker-start
---
<div>{{SVGRef}}</div>

<p><strong><code>marker-start</code></strong> 属性将在给定<a href="/zh-CN/docs/Web/SVG/Element#Shape_elements">形状</a>的起始顶点绘制的箭头或者多边形标记</p>

<p>对于除SVG的polyline和path元素之外的所有形状元素,最后的一个顶点与第一个顶点相同。在这种情况下,如果SVG的<code>marker-start</code>属性和 {{SVGAttr("marker-end")}} 的值都不是 <code>none</code> ,然后再最后一个顶点渲染两个图标。 对于一个 <code>&lt;path&gt;</code> 元素, 对于每个封闭的子路径,他的最后一个顶点都与第一个顶点相同。 <code>marker-end</code> 仅在<a href="/zh-CN/docs/Web/SVG/Attribute/d#Path_commands">路径数据</a>的起始顶点上呈现。</p>

<p class="note"><strong>Note:</strong>作为一个图像属性, <code>marker-start</code> 可以用作css属性.</p>

<p>作为一个图像属性,他可以应用到所有的元素上,但是他只针对于一下其中元素有效:  {{SVGElement("circle")}}, {{SVGElement("ellipse")}}, {{SVGElement("line")}}, {{SVGElement("path")}}, {{SVGElement("polygon")}}, {{SVGElement("polyline")}}, 和{{SVGElement("rect")}}</p>

<div id="topExample">
<div class="hidden">
<pre class="brush: css notranslate">html, body, svg {
  height: 100%;
}</pre>
</div>

<pre class="brush: html; hightlight[12] notranslate">&lt;svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"&gt;
  &lt;defs&gt;
    &lt;marker id="triangle" viewBox="0 0 10 10"
          refX="1" refY="5"
          markerUnits="strokeWidth"
          markerWidth="10" markerHeight="10"
          orient="auto"&gt;
      &lt;path d="M 0 0 L 10 5 L 0 10 z" fill="#f00"/&gt;
    &lt;/marker&gt;
  &lt;/defs&gt;
  &lt;polyline fill="none" stroke="black"
      points="20,100 40,60 70,80 100,20" marker-start="url(#triangle)"/&gt;
&lt;/svg&gt;
</pre>

<p>{{EmbedLiveSample("topExample", "200", "200")}}</p>
</div>

<h2 id="使用说明">使用说明</h2>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"></th>
   <td><code>none</code> | <code>&lt;marker-ref&gt;</code></td>
  </tr>
  <tr>
   <th scope="row">默认值</th>
   <td><code>none</code></td>
  </tr>
  <tr>
   <th scope="row">可用作与动画</th>
   <td></td>
  </tr>
 </tbody>
</table>

<dl>
 <dt><code>none</code></dt>
 <dd>表示将不会在起点绘制任何符号。</dd>
 <dt><code>&lt;marker-ref&gt;</code></dt>
 <dd>这个值表示的是对 <a href="/zh-CN/docs/Web/SVG/Element/marker" title="marker元素定义了在特定的&lt;path>元素、&lt;line>元素、&lt;polyline>元素或者&lt;polygon>元素上绘制的箭头或者多边标记图形。"><code>&lt;marker&gt;</code></a> 元素的引用, 将在起点绘制该元素.。如果引用无效,将不会绘制任何东西。</dd>
</dl>

<h2 id="技术指标">技术指标</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("SVG2", "painting.html#MarkerStartProperty", "marker-start")}}</td>
   <td>{{Spec2("SVG2")}}</td>
   <td>No significant change</td>
  </tr>
  <tr>
   <td>{{SpecName("SVG1.1", "painting.html#MarkerStartProperty", "marker-start")}}</td>
   <td>{{Spec2("SVG1.1")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("svg.attributes.presentation.marker-start")}}</p>

<h2 id="另见">另见</h2>

<ul>
 <li>{{SVGElement("marker")}}</li>
 <li>{{SVGAttr("marker-end")}}</li>
 <li>{{SVGAttr("marker-mid")}}</li>
</ul>