提示访客通过按钮样式的链接采取行动。

  • 名称: core/button
  • 类别: 设计
  • API 版本: 3
  • 块类型: 混合(静态保存 + 服务器增强)
  • 关键词: link

块关系

父级块(直接):
– core/buttons

属性

通过 block.json 中的 attributes 属性定义。

属性类型默认值描述
tagNamestring"a"枚举: a, button
typestring"button"—
urlstring—来源: attribute。 选择器: a。 HTML 属性: href。 角色: content
titlestring—来源: attribute。 选择器: a,button。 HTML 属性: title。 角色: content
textrich-text—来源: rich-text。 选择器: a,button。 角色: content
linkTargetstring—来源: attribute。 选择器: a。 HTML 属性: target。 角色: content
relstring—来源: attribute。 选择器: a。 HTML 属性: rel。 角色: content
placeholderstring——
backgroundColorstring——
textColorstring——
gradientstring——

支持功能

通过 block.json 中的 supports 属性定义。

块样式

通过 block.json 中的 styles 属性定义。

样式名称标签默认值
fill填充是
outline轮廓否

CSS 选择器

通过 block.json 中的 selectors 属性定义。

  • 根: .wp-block-button .wp-block-button__link
  • 排版:
    • writingMode: .wp-block-button
  • 尺寸:
    • 根: .wp-block-button
    • 宽度: .wp-block-button

块标记

这是一个 混合块。它保存静态标记,服务器在渲染期间可能会对其进行增强。

<!-- wp:button {"tagName":"a","type":"button"} -->
<!-- Content... -->
<!-- /wp:button -->

来源