# Style Inheritance > **NOTE** > > The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. A custom component has the **inherit-class** attribute, which is defined in the following table. | Name | Type | Default Value | Mandatory | Description | | ------------- | ------ | ---- | ---- | -------------------------------- | | inherit-class | string | - | No | Class styles inherited from the parent component, separated by spaces.| To enable a custom component to inherit the styles of its parent component, set the **inherit-calss** attribute for the custom component. The example below is a code snippet in the HML file of the parent component that references a custom component named **comp**. This component uses the **inherit-class** attribute to inherit the styles of its parent component: **parent-class1** and **parent-class2**. ```html
``` Code snippet in the CSS file of the parent component: ```css /* xxx.css */ .parent-class1 { background-color:red; border:2px; } .parent-class2 { background-color:green; border:2px; } ``` Code snippet in the HML file of the custom component, where **parent-class1** and **parent-class2** are styles inherited from the parent component: ```html
Style 1 inherited from the parent component Style 2 inherited from the parent component
```