# tspan The **\** component is used to add a text style. > **NOTE** > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > > - This component can have **\** child components nested. > > - This component can only be nested by the parent element label **svg**. ## Required Permissions None ## Child Components The **[\](js-components-svg-tspan.md)** child component is supported. The attributes in the following table are supported. | Name | Type | Default Value | Mandatory | Description | | -------------- | ---------------------------------- | ----- | ---- | ---------------------------------------- | | id | string | - | No | Unique ID of the component. | | x | <length>\|<percentage> | 0 | No | X-coordinate of the upper left corner of the component. | | y | <length>\|<percentage> | 0 | No | Y-coordinate of the upper left corner of the component. This attribute is invalid when the component is a child component of the **\**. | | dx | <length>\|<percentage> | 0 | No | Offset of the text on the x-axis. | | dy | <length>\|<percentage> | 0 | No | Offset of the text on the y-axis. This attribute is invalid when the component is a child component of the **\**. | | rotate | number | 0 | No | Rotation of the text around its lower left corner. A positive number indicates clockwise rotation, and a negative number indicates counterclockwise rotation. | | font-size | <length> | 30px | No | Font size. | | fill | <color> | black | No | Fill color of the text. | | opacity | number | 1 | No | Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent. Attribute animations are supported.| | fill-opacity | number | 1.0 | No | Fill opacity of the text. | | stroke | <color> | black | No | Stroke color. | | stroke-width | number | 1px | No | Stroke width. | | stroke-opacity | number | 1.0 | No | Stroke opacity. | ## Example ```html
zero text. first span. second span. third span. first span. second span. third span. forth span.
``` ```css /* xxx.css */ .container { flex-direction: row; justify-content: flex-start; align-items: flex-start; height: 1000px; width: 1080px; } ``` ![tspan-part1](figures/tspan-part1.png) Attribute animation example ```html
tspan attribute x|opacity|rotate tspan attribute dx
``` ```css /* xxx.css */ .container { flex-direction: row; justify-content: flex-start; align-items: flex-start; height: 3000px; width: 1080px; } ``` ![tspan-animate-part1](figures/tspan-animate-part1.gif) ```html
tspan attribute fill|fill-opacity
``` ![tspan-animate-part2](figures/tspan-animate-part2.gif) ```html
tspan attribute font-size
``` ![tspan-animate-part3](figures/tspan-animate-part3.gif) ```html
tspan attribute stroke tspan attribute stroke-width-opacity
``` ![tspan-animate-part4](figures/tspan-animate-part4.gif)