提示访客通过按钮样式的链接采取行动。
块关系
父级块(直接):
– core/buttons
属性
通过 block.json 中的 attributes 属性定义。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
tagName | string | "a" | 枚举: a, button |
type | string | "button" | — |
url | string | — | 来源: attribute。 选择器: a。 HTML 属性: href。 角色: content |
title | string | — | 来源: attribute。 选择器: a,button。 HTML 属性: title。 角色: content |
text | rich-text | — | 来源: rich-text。 选择器: a,button。 角色: content |
linkTarget | string | — | 来源: attribute。 选择器: a。 HTML 属性: target。 角色: content |
rel | string | — | 来源: attribute。 选择器: a。 HTML 属性: rel。 角色: content |
placeholder | string | — | — |
backgroundColor | string | — | — |
textColor | string | — | — |
gradient | string | — | — |
支持功能
通过 block.json 中的 supports 属性定义。
anchor:truesplitting:truealign:falsealignWide:falsebackground:backgroundImage:truebackgroundSize:truegradient:true
color:gradients:true
dimensions:width:true
typography:fontSize:truelineHeight:truetextAlign:true
reusable:falseshadow:truespacing:padding:["horizontal","vertical"]
interactivity:clientNavigation:true
块样式
通过 block.json 中的 styles 属性定义。
| 样式名称 | 标签 | 默认值 |
|---|---|---|
fill | 填充 | 是 |
outline | 轮廓 | 否 |
CSS 选择器
通过 block.json 中的 selectors 属性定义。
- 根:
.wp-block-button .wp-block-button__link - 排版:
- writingMode:
.wp-block-button
- writingMode:
- 尺寸:
- 根:
.wp-block-button - 宽度:
.wp-block-button
- 根:
块标记
这是一个 混合块。它保存静态标记,服务器在渲染期间可能会对其进行增强。
<!-- wp:button {"tagName":"a","type":"button"} -->
<!-- Content... -->
<!-- /wp:button -->
来源
- block.json (参考)
- 源代码目录 — 浏览
edit和save源文件、index.php等。