UI Toolbox 徽标UI Toolbox
支持

本页为译文。技术支持和视频教程主要使用英语,内容以英文页面为准。 英文版

文本类

文本类让 Label 具有标题、引导文字、次要文字或行内代码的外观。它们在 WindowStyles.uss 中,因此对工作区里的每个标签都有效。

从大到小的四级标题、一段引导文字、一段暗淡文字和一行带行内代码的文字从大到小的四级标题、一段引导文字、一段暗淡文字和一行带行内代码的文字

制作页面头部的方法:

<ui:Label text="Graphics" class="tb-text-h1" />
<ui:Label
    text="Settings for the picture quality and the screen."
    class="tb-text-lead" />
<ui:Label text="Display" class="tb-text-h3" />
<ui:Label text="The changes apply at once." class="tb-text-muted" />
<ui:VisualElement style="flex-direction: row;">
    <ui:Label text="Start the game with" />
    <ui:Label text="-screen-fullscreen 0" class="tb-text-code" />
</ui:VisualElement>
var title = new Label("Graphics");
title.AddToClassList("tb-text-h1");
类 外观
tb-text-h1 一级标题:粗体,24 px。
tb-text-h2 二级标题:粗体,20 px。
tb-text-h3 三级标题:粗体,17 px。
tb-text-h4 四级标题:粗体,使用 --tb-font-size-lg。
tb-text-lead 页面标题下方的文字:--tb-font-size-lg,颜色为 --tb-color-text-muted。
tb-text-muted 次要文字:--tb-font-size-sm,颜色为 --tb-color-text-muted。
tb-text-code 行内代码:等宽字体,背景为 --tb-color-surface-alt,圆角为 --tb-radius-sm。

提示:

.tb-text-h1 { font-size: 32px; }