1e41f4b71Sopenharmony_ci# ContainerSpan
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciAs a child of the [Text](ts-basic-components-text.md) component, the **ContainerSpan** component is used to manage the background colors and rounded corners of multiple [Span](ts-basic-components-span.md) and [ImageSpan](ts-basic-components-imagespan.md) components in a unified manner.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Child Components
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThis component can contain the [Span](ts-basic-components-span.md) and [ImageSpan](ts-basic-components-imagespan.md) child components.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## APIs
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciContainerSpan()
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci## Attributes
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciOnly the following attributes are supported.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci### textBackgroundStyle
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_citextBackgroundStyle(style: TextBackgroundStyle)
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciSets the text background style If this attribute is not separately set for a child component, the child component inherits the settings from the component.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**Parameters**
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci| Name| Type                                               | Mandatory| Description                                                        |
38e41f4b71Sopenharmony_ci| ------ | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
39e41f4b71Sopenharmony_ci| style  | [TextBackgroundStyle](ts-basic-components-span.md#textbackgroundstyle11) | Yes  | Text background style.<br>Default value:<br>{<br>  color: Color.Transparent,<br>  radius: 0<br>} |
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci### attributeModifier<sup>12+</sup>
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciattributeModifier(modifier: AttributeModifier\<ContainerSpanAttribute>)
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciCreates an attribute modifier.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci**Parameters**
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci| Name| Type                                               | Mandatory| Description                                                        |
54e41f4b71Sopenharmony_ci| ------ | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
55e41f4b71Sopenharmony_ci| modifier  | [AttributeModifier](ts-universal-attributes-attribute-modifier.md#attributemodifiert)\<ContainerSpanAttribute> | Yes  | Modifier for dynamically setting attributes on the current component.|
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci## Events
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci## Example
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci```ts
64e41f4b71Sopenharmony_ci// xxx.ets
65e41f4b71Sopenharmony_ci@Component
66e41f4b71Sopenharmony_ci@Entry
67e41f4b71Sopenharmony_cistruct Index {
68e41f4b71Sopenharmony_ci  build() {
69e41f4b71Sopenharmony_ci    Column() {
70e41f4b71Sopenharmony_ci      Text() {
71e41f4b71Sopenharmony_ci        ContainerSpan() {
72e41f4b71Sopenharmony_ci          ImageSpan($r('app.media.app_icon'))
73e41f4b71Sopenharmony_ci            .width('40vp')
74e41f4b71Sopenharmony_ci            .height('40vp')
75e41f4b71Sopenharmony_ci            .verticalAlign(ImageSpanAlignment.CENTER)
76e41f4b71Sopenharmony_ci          Span('   Hello World !   ').fontSize('16fp').fontColor(Color.White)
77e41f4b71Sopenharmony_ci        }.textBackgroundStyle({color: "#7F007DFF", radius: "12vp"})
78e41f4b71Sopenharmony_ci      }
79e41f4b71Sopenharmony_ci    }.width('100%').alignItems(HorizontalAlign.Center)
80e41f4b71Sopenharmony_ci  }
81e41f4b71Sopenharmony_ci}
82e41f4b71Sopenharmony_ci```
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ci![imagespan](figures/container_span.png)
85