如何使标题在图像上居中对齐

问题描述 投票:0回答:1

我使用的是WP 5.3.2,带有自定义(旧)的Atahualpa主题。我正在努力工作并正在用块构建的新页面是http://www.allpowerlabs.com/chartainer,尽管主题的表面设置很明显,但缩略图链接下方的标题仍然对齐。

使用经典编辑器构建的较旧的寻呼机将标题居中。我在其他线程中看到了各种解决方案,例如添加figcaption text-align css,而且这是主题确定的设置。我主题的编辑器显示以下字幕设置:

border: 0px solid #dddddd;
text-align: center;
background-color: #f3f3f3;
padding-top: 4px;
margin: 10px 0 0 0;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;

[我怀疑这可能是由于主题的PHP或CSS中使用了旧的HTML标准,但无法弄清楚如何以及在何处插入更改(我是设计师,而不是编码人员,请尽量不要接触PHP,但是仅用于主题的编辑器)。

css wordpress wordpress-gutenberg
1个回答
0
投票

您要将其添加到主题的CSS:

.wp-block-image .aligncenter > figcaption,
.wp-block-image .alignleft > figcaption,
.wp-block-image .alignright > figcaption,
.wp-block-image.is-resized > figcaption {
   text-align: center;
}

请确保您熟悉browser developer tools,可以在那里检查CSS并临时进行更改以查看效果。

© www.soinside.com 2019 - 2024. All rights reserved.