1. Style Import
Use
@import
statement outreach stylesheet may be introduced,@import
followed by the relative path to be imported stylesheet outreach, with;
the end of the statement represented.
First create a file in the page file to style, and write a style file box.wxss;
box.wxss:
.box{
height: 100px;
width: 100px;
color: blueviolet;
font-size: 50px;
}
Then create a new file, write the contents of a file in its wxml inside;
wxml:
<view class="box">box</view>
Here we need to import wxss file inside;
@import "../style/box.wxss";
Note here that the directory hierarchy problem, because the style file is a file with the Index is juxtaposed, so to return to the previous file directory;
running result: