主题
BSS 速查
BSS(Behemiron Style Sheet)属性速查表,涵盖布局、视觉与组件专属属性。
Quick Start
css
/* 基本布局 */
.container {
display: flex;
flex-direction: column;
gap: 4px;
padding: 8px;
background: sdf(4, #333333, #666666, 1);
}
/* 变量 + 悬停效果 */
.btn {
--accent: #4aa3ff;
color: var(--accent);
transition: background 200ms ease;
}
.btn:hover {
background: sdf(4, #444444);
}Layout / Box
| 属性 | 可选值 / 示例 | 说明 |
|---|---|---|
display | block | flex | grid | none | 显示模式 |
position | relative | absolute | 定位方式 |
box-sizing | border-box | content-box | 盒模型 |
top / right / bottom / left | 长度值 | 定位偏移 |
inset | 简写 | 四方向定位简写 |
margin / margin-* | 长度值 | 外边距(支持 -top, -right, -bottom, -left, -inline, -block 等) |
padding / padding-* | 长度值 | 内边距(同 margin 后缀) |
border / border-* | 长度值 | 边框宽度(同 margin 后缀) |
width / height | 长度值 | 尺寸 |
min-width / min-height | 长度值 | 最小尺寸 |
max-width / max-height | 长度值 | 最大尺寸 |
aspect-ratio | 16 / 9 | 宽高比 |
gap / row-gap / column-gap | 长度值 | 间距 |
overflow / overflow-x / overflow-y | visible | hidden | scroll | 溢出行为 |
Flex
| 属性 | 可选值 / 示例 | 说明 |
|---|---|---|
flex-direction | row | column | 主轴方向 |
flex-wrap | nowrap | wrap | 换行行为 |
flex-flow | row wrap | flex-direction + flex-wrap 简写 |
flex-grow | 数值 | 放大比例 |
flex-shrink | 数值 | 缩小比例 |
flex-basis | 长度值 | auto | 基准尺寸 |
flex | 1 0 auto | 简写 |
order | 整数 | 排列顺序 |
justify-content | flex-start | center | flex-end | space-between | space-around | space-evenly | 主轴对齐 |
align-items | flex-start | center | flex-end | stretch | 交叉轴对齐 |
align-self | 同 align-items | 单项交叉轴对齐 |
align-content | 同 justify-content | 多行交叉轴对齐 |
place-items / place-self / place-content | 简写 | 对齐简写 |
Grid
| 属性 | 可选值 / 示例 | 说明 |
|---|---|---|
grid-template-columns | repeat(3, 1fr) | 列模板 |
grid-template-rows | auto 1fr | 行模板 |
grid-template-areas | "header" "body" | 区域命名 |
grid-auto-columns / grid-auto-rows | 长度值 | 自动列/行尺寸 |
grid-auto-flow | row | column | 自动排列方向 |
grid-column | 1 / span 2 | 列位置 |
grid-row | 2 / 4 | 行位置 |
grid-area | header | 区域指定 |
Text / Typography
| 属性 | 可选值 / 示例 | 默认值 | 说明 |
|---|---|---|---|
color | 颜色值 | #FFFFFFFF | 文本颜色(可继承) |
font-size | 浮点数 | 9 | 字体大小(可继承) |
bss-font-resource | 资源路径 | minecraft:default | 字体资源(可继承,非标准 BSS 属性) |
bss-text-shadow-enabled | none | 其他 | none(false) | 文本阴影开关(可继承,非标准 BSS 属性) |
text-align | left | center | right | — | 文本对齐(标准子集) |
bss-text-vertical-align | top | center | bottom | top | 文本垂直对齐(非标准 BSS 属性) |
bss-text-wrap-mode | wrap | nowrap | roll | hover-roll | hide | nowrap | 文本包裹/滚动模式(非标准 BSS 属性) |
line-height | 数值 | normal | normal | 行高(可继承) |
line-spacing | 浮点数 | 1 | 行间距(可继承) |
roll-speed | 浮点数 | 1 | 滚动速度 |
adaptive-width | true | false | false | 自适应宽度 |
adaptive-height | true | false | false | 自适应高度 |
Visual
| 属性 | 可选值 / 示例 | 说明 |
|---|---|---|
background | 颜色值 / 纹理 | 背景 |
opacity | 0 ~ 1 | 不透明度 |
z-index | 整数 | 层级 |
transform | scale(1.2) / rotate(45deg) | 变换 |
transition | background 200ms ease | 过渡动画 |
bss-scrollbar-size | 长度值 | 滚动条尺寸(非标准 BSS 属性) |
变量
css
/* 定义 */
:root {
--accent: #4aa3ff;
--bg: #1a1a2e;
}
/* 使用 */
.panel {
color: var(--accent);
background: var(--bg);
}Container Query
| 属性 | 可选值 | 说明 |
|---|---|---|
container-type | normal | size | inline-size | 容器类型 |
container-name | 字符串 | 容器名称 |
组件专属 BSS 属性
Button
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
base-background | Texture | RECT_RD | 基础背景 |
hover-background | Texture | RECT_RD_LIGHT | 悬停背景 |
pressed-background | Texture | RECT_RD_DARK | 按下背景 |
TextField
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
text-field-error-color | Color | #FFFF0000 | 错误文本颜色 |
text-field-cursor-color | Color | #FFFFFFFF | 光标颜色 |
text-field-placeholder | String | "" | 占位符文本 |
text-field-focus-overlay | Texture | RECT_RD_T_SOLID | 焦点覆盖层 |
TextArea
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
text-area-error-color | Color | #FFFF0000 | 错误文本颜色 |
text-area-cursor-color | Color | #FFFFFFFF | 光标颜色 |
text-area-placeholder | String | "" | 占位符文本 |
text-area-focus-overlay | Texture | RECT_RD_T_SOLID | 焦点覆盖层 |
Toggle / Checkbox
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
unmark-background | Texture | EMPTY | 未选中标记 |
mark-background | Texture | CHECK_SPRITE | 选中标记 |
Switch
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
switch-base-background | Texture | RECT_RD_DARK | 基础背景 |
switch-pressed-background | Texture | RECT_RD_T | 开启时背景 |
switch-unmark-background | Texture | RECT_RD | 未选中标记 |
switch-mark-background | Texture | RECT_RD | 选中标记 |
Scroller
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
scroll-delta | Float | 0.1 | 滚动增量 |
scroll-bar-size | Float | 50 | 滚动条大小(百分比) |
ScrollerView
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
scroller-view-margin | Float | 2 | 滚动视图边距 |
scroller-view-mode | Enum | VERTICAL | 滚动模式(VERTICAL/HORIZONTAL/BOTH) |
scroller-vertical-display | Enum | AUTO | 垂直滚动条显示(AUTO/ALWAYS/NEVER) |
scroller-horizontal-display | Enum | AUTO | 水平滚动条显示 |
min-scroll-pixel | Float | 10 | 最小滚动像素 |
max-scroll-pixel | Float | 100 | 最大滚动像素 |
Selector / SearchComponent
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
selector-focus-overlay | Texture | RECT_RD_T_SOLID | 焦点覆盖层 |
selector-max-item | Int | 5 | 最大显示项数 |
selector-view-height | Float | 50 | 滚动视图高度 |
selector-show-overlay | Bool | true | 是否显示悬停覆盖 |
selector-close-after-select | Bool | true | 选择后自动关闭 |
ProgressBar
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
fill-direction | Enum | LEFT_TO_RIGHT | 填充方向 |
progress-interpolate | Bool | false | 是否启用插值动画 |
progress-interpolate-step | Float | 0.05 | 插值步长 |
GraphView
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
graph-allow-zoom | Bool | true | 允许缩放 |
graph-allow-pan | Bool | true | 允许平移 |
graph-min-scale | Float | 0.1 | 最小缩放 |
graph-max-scale | Float | 10 | 最大缩放 |
graph-grid-background | Texture | 网格纹理 | 网格背景 |
graph-grid-size | Float | 16 | 网格尺寸 |
SplitView
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
split-border-size | Float | 2 | 分割条命中宽度(px) |
split-min-percentage | Float | 5 | 最小百分比 |
split-max-percentage | Float | 95 | 最大百分比 |
TreeList
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
tree-node-background | Texture | EMPTY | 节点背景 |
tree-node-hover-background | Texture | 蓝色矩形 | 悬停/选中背景 |
tree-collapse-icon | Texture | 右箭头 | 折叠图标 |
tree-expand-icon | Texture | 下箭头 | 展开图标 |
Menu
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
menu-node-background | Texture | EMPTY | 节点背景 |
menu-leaf-background | Texture | EMPTY | 叶节点背景 |
menu-node-hover-background | Texture | 蓝色矩形 | 节点悬停背景 |
menu-leaf-hover-background | Texture | 蓝色矩形 | 叶节点悬停背景 |
menu-arrow | Texture | 右箭头 | 箭头图标 |
ItemSlot
| BSS 属性名 | 类型 | 默认值 | 说明 |
|---|---|---|---|
item-slot-hover-overlay | Texture | 半透明白色 | 悬停覆盖层 |
show-item-tooltips | Bool | true | 显示物品提示 |
is-player-slot | Bool | false | 是否为玩家槽位 |
accept-quick-move | Bool | true | 接受快速移动 |
quick-move-priority | Int | 0 | 快速移动优先级 |
严格模式
非法简写、历史别名、不支持的语义会直接报错。建议联动 BSS 参考(零基础完整版) 使用。