简体中文
font-weight 属性用于设置字体的粗细程度。
| Web | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|
| 4.0 | 3.9 | 4.11 | 4.61 | 5.0 |
font-weight: <font-weight-absolute>{1,2};
| 名称 | 兼容性 | 描述 |
|---|---|---|
| normal | 正常粗细。与 400 等值。 | |
| bold | 加粗。与 700 等值。 | |
| 400 | 正常粗细,与 normal 等值。 | |
| 500 | Medium | |
| 600 | Semi Bold (Demi Bold) | |
| 700 | 加粗,与 bold 等值。 |
normal
示例为hello uni-app x alpha分支,与最新HBuilderX Alpha版同步。与最新正式版同步的master分支示例另见
示例
<template>
<view style="flex-grow: 1;">
<view style="height: 250px;background-color: gray;justify-content: center;align-items: center;">
<text class="common" style="font-weight: normal;">font-weight: normal</text>
<text class="common" style="font-weight: bold;">font-weight: bold</text>
<text class="common" style="font-weight: 400;">font-weight: 400</text>
<text class="common" style="font-weight: 700;">font-weight: 700</text>
</view>
</view>
</template>
<script>
</script>
<style>
.common {
font-size: 20px;
}
</style>