1、支持rpx(小程序样式单位),即响应式px,一种根据屏幕宽度自适应的动态单位,以750宽的屏幕为基准,即750rpx为屏幕宽度,375rpx为屏幕的一半
2、使用@import导入外联样式表
3、在当前页面填写的样式即为当前页面的样式(局部样式),不必加scope,在App.vue中添加的样式为全局样式,局部样式会覆盖全局样式
4、支持基本常用的选择器,例如class\id等等,不支持 * 选择器
5、添加字体图标
字体文件的引用推荐使用-@开头的绝对路径
使用字体图标的步骤
1)将字体图标的css文件引入到App.vue页面的<style>中
@import url("./static/iconfont/iconfont.css");
2)将字体图标的css的文件中的图标引用都改为以~@开头的绝对路径,否则会报错
@font-face {font-family: "iconfont";
src: url('~@/static/iconfont/iconfont.eot?t=1576844226174'); /* IE9 */
src: url('~@/static/iconfont/iconfont.eot?t=1576844226174#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAVMAAsAAAAAChwAAAT9AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCDKAqHQIYhATYCJAMUCwwABCAFhG0HUBurCFGUTk6f7Edh3LaEI5xY7HYeoWNK7zwLfd/7ZDz8/37f9rny/h3XpE711SdNQq1REh4bhEQoLLJn8v/facvNLUze6duSsZbv+GnTlb7095Zi+lMOtlEU4UA4hIXh39Neujkz1HYC0ju3M1Ac9Uf+ce/0z/PA5qOyXP5orGFznpcFmGBAY2xsawEOyhL0FvEsLiQTuJ7AoFUtsVtbBxckq4BugXjNDYVkbRYlhBOavvMZW7ZjpmrpbfpEfFY/H/8MIktSM+h78XRTJys/2///CaSPuC0jpPm5cJtExh6iEM99PQ8l9NiehMFPZtIVRMNXEj+zb0beXPT/M1lbNI395ZEVieiAZpiR1+KFn1lRTOZnifXTnlARyZg1+Tgxt7EMYgmJIyQ+AMNyCeqKWeO9ZOlV6Y7jtTFeKQ8tRm5qIlYcXy1Oyh9fVuuJ2tZ0WWdWhKmbl3MZu/sBgAGj+GXDAAynUbHQsuY1Dsowei8GE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DIUNKfiSvACnAa6f6Onox0G2NF6tkXRoHhgwDCDHeiZEEF7VFXcDBmED5/q0sQIM6zBQR35wuq8Tiajrl69xpLD0VysKcNVLkKFGj070xuc+9NIZyWPEKRig1moQj4YKXnvKJzUwIAAAA') format('woff2'),
url('~@/static/iconfont/iconfont.woff?t=1576844226174') format('woff'),
url('~@/static/iconfont/iconfont.ttf?t=1576844226174') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */
url('~@/static/iconfont/iconfont.svg?t=1576844226174#iconfont') format('svg'); /* iOS 4.1- */
}
3)使用字体图标
<text class="iconfont"></text>
4、scss或less
1)安装scss\less插件后,
2)可以在uni.scss中定义样式,然后在页面中引用,有利于页面样式的统一
.box{
background-color: $uni-bg-color;
}