aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/svg/attribute/stroke/index.html
blob: 396de010c91f09f71bedefbc0f70579d7f57304b (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
---
title: stroke
slug: Web/SVG/Attribute/stroke
tags:
  - SVG
  - SVG属性
  - 需要兼容性表
translation_of: Web/SVG/Attribute/stroke
---
<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG属性参考主页</a></p>

<p><code>stroke</code>属性定义了给定图形元素的外轮廓的颜色。它的默认值是<strong>none</strong></p>

<h2 id="用法">用法</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="row">类别</th>
   <td>外观属性</td>
  </tr>
  <tr>
   <th scope="row"></th>
   <td><a href="/en/SVG/Content_type#Paint" title="en/SVG/Content_type#Paint">&lt;paint&gt;</a></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#StrokeProperty">SVG 1.1 (2nd Edition)</a></td>
  </tr>
 </tbody>
</table>

<h2 id="示例">示例</h2>

<p></p>

<h2 id="SVG_Line" name="SVG_Line">SVG 描边的线</h2>

<h3 id="示例1:用stroke属性画一条绿色的直线.">示例1:用stroke属性画一条绿色的直线.</h3>

<pre class="brush: html">&lt;svg height="50" width ="300"&gt;
    &lt;path stroke = "green" d="M5 20 1215 0" /&gt;
&lt;/svg&gt;</pre>

<h3 id="sect1"> </h3>

<h3 id="示例2:用Stroke属性画一个拥有蓝色边框的黑色的圆形">示例2:用Stroke属性画一个拥有蓝色边框的黑色的圆形</h3>

<pre class="brush: html">​​&lt;svg height="200" width="200"&gt;
    &lt;circle cx="50" cy="50" r="40" stroke="blue" stroke-width="2" fill ="black" /&gt;
&lt;/svg&gt;</pre>

<p> </p>

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

<p>下列元素可以使用<code>stroke</code>属性:</p>

<ul>
 <li><a href="https://developer.mozilla.org/en/SVG/Element#Shape" title="en/SVG/Element#Shape">形状元素</a> »</li>
 <li><a href="https://developer.mozilla.org/en/SVG/Element#TextContent" title="en/SVG/Element#TextContent">文本内容元素</a> »</li>
</ul>