目录

CSS

Similar to CSS style, ASCF style is used to describe the styles and determine the display effects of HXML components.

To better develop atomic services, ASCF inherits from CSS and expands its features, including style import, global style, and local style.

rpx

The responsive pixel (rpx) unit is supported in ASCF. It is adaptive based on the screen width and specifies the screen width to 750 rpx.

Style Import

You can use the @import statement to import an external style sheet. @import is followed by the path of the external style sheet and ends with a semicolon (;).

Sample code:

/* /page/common/index.css */
.import-color {
    color: red;
}
/* /page/index/index.css */
@import "/page/common/index.css";
.classColor {
    color: blue;
}

Inline Style

The style and class attributes can be used to specify the component style.

Sample code:

Selector

Currently, the following selectors are supported.

Selector Example Description
Class .classColor Selects the component whose class attribute is set to classColor.
ID #idColor Selects the component whose id attribute is set to idColor.
Tag view Selects all view components.
::after pseudo-element view::after Inserts content after the view component.
::before pseudo-element view::before Inserts content before the view component.

Global Style and Local Style