1# span
2
3>  **说明:**
4>  从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
5
6作为<[text](js-components-basic-text.md)>子组件提供文本修饰能力。
7
8## 权限列表
9
1011
12
13## 子组件
14
1516
17
18## 属性
19
20支持[通用属性](js-components-common-attributes.md)。
21
22>  **说明:**
23>  不支持focusable和disabled属性。
24
25
26## 样式
27
28仅支持如下样式:
29
30| 名称              | 类型                         | 默认值        | 必填   | 描述                                       |
31| --------------- | -------------------------- | ---------- | ---- | ---------------------------------------- |
32| color           | <color>              | -          | 否    | 设置文本段落的文本颜色。                             |
33| font-size       | <length>             | 30px       | 否    | 设置文本段落的文本尺寸。                             |
34| allow-scale     | boolean                    | true       | 否    | 设置文本段落的文本尺寸是否跟随系统设置字体缩放尺寸进行放大缩小。<br/>如果在config描述文件中针对ability配置了fontSize的config-changes标签,则应用不会重启而直接生效。 |
35| font-style      | string                     | normal     | 否    | 设置文本段落的字体样式,见[text组件font-style的样式属性](js-components-basic-text.md#样式)。 |
36| font-weight     | number&nbsp;\|&nbsp;string | normal     | 否    | 设置文本段落的字体粗细,见[text组件font-weight的样式属性](js-components-basic-text.md#样式)。 |
37| text-decoration | string                     | none       | 否    | 设置文本段落的文本修饰,见[text组件text-decoration样式属性](js-components-basic-text.md#样式)。 |
38| font-family     | string                     | sans-serif | 否    | 设置文本段落的字体列表,用逗号分隔,每个字体用字体名或者字体族名设置。列表中第一个系统中存在的或者通过[自定义字体](js-components-common-customizing-font.md)指定的字体,会被选中作为文本的字体。 |
39
40
41## 事件
42
43仅支持[通用事件](js-components-common-events.md)中的click事件。
44
45
46## 方法
47
48不支持。
49
50
51## 示例
52
53```html
54<!-- xxx.hml -->
55<div class="container">
56  <text class="title">
57    <span class="spanTxt">span</span>
58  </text>
59</div>
60```
61
62```css
63/* xxx.css */
64.container {
65  display: flex;
66  justify-content: center;
67  align-items: center;
68}
69.title {
70  font-size: 30px;
71  text-align: center;
72  width: 100%;
73  height: 100px;
74}
75.spanTxt{
76  color: chartreuse;
77  font-size: 80px;
78}
79```
80
81![zh-cn_image_0000001152588626](figures/zh-cn_image_0000001152588626.png)
82