aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/stroke-linecap/index.html
blob: 7eda100b93e672529f530e15b13c82b318eb7c2a (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
---
title: stroke-linecap
slug: Web/SVG/Attribute/stroke-linecap
tags:
  - SVG
  - SVG 属性
translation_of: Web/SVG/Attribute/stroke-linecap
---
<p>« <a href="/en-US/docs/Web/SVG/Attribute" title="en-US/docs/Web/SVG/Attribute">SVG 属性 参照主页</a></p>

<p><code>stroke-linecap</code> 属性制定了,在开放子路径被设置描边的情况下,用于开放自路径两端的形状。</p>

<p>作为一个展现属性,它也可以在一个CSS样式表内部,作为一个属性直接使用。</p>

<h2 id="使用背景">使用背景</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">分类</th>
   <td>展现属性</td>
  </tr>
  <tr>
   <th scope="row">属性值</th>
   <td>butt | round | square | inherit</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/SVG/painting.html#StrokeLinecapProperty">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="Example">Example</h2>

<pre class="brush: html">&lt;?xml version="1.0"?&gt;
&lt;svg width="120" height="120"
     viewPort="0 0 120 120" version="1.1"
     xmlns="http://www.w3.org/2000/svg"&gt;

    &lt;line stroke-linecap="butt"
          x1="30" y1="30" x2="30" y2="90"
          stroke="black" stroke-width="20"/&gt;

    &lt;line stroke-linecap="round"
          x1="60" y1="30" x2="60" y2="90"
          stroke="black" stroke-width="20"/&gt;

    &lt;line stroke-linecap="square"
          x1="90" y1="30" x2="90" y2="90"
          stroke="black" stroke-width="20"/&gt;

    &lt;path d="M30,30 L30,90 M60,30 L60,90 M90,30 L90,90"
          stroke="white" /&gt;
&lt;/svg&gt;</pre>

<p><strong>实时样例</strong></p>

<p>{{ EmbedLiveSample('Example','120','120') }}</p>

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

<p>以下元素可以使用<code>stroke-linecap</code> 属性</p>

<ul>
 <li><a href="/en-US/docs/Web/SVG/Element#Shape" title="en-US/docs/Web/SVG/Element#Shape">图形元素</a> »</li>
 <li><a href="/en-US/docs/Web/SVG/Element#TextContent" title="en-US/docs/Web/SVG/Element#TextContent">文本内容元素</a> »</li>
</ul>