简体   繁体   English

在PHP / CSS中居中标题?

[英]Centering Headings in PHP/CSS?

I thought I had figured this out in the Custom CSS box of this Wordpress theme but no joy. 我以为我已经在此Wordpress主题的“自定义CSS”框中找到了答案,但没有任何乐趣。 I just can't get the headings centered! 我只是无法使标题居中!

http://growing-underground.com/ (password = nugget13) http://growing-underground.com/ (密码= nugget13)

I really want to get these headings centered – I managed it using inline styling but when I try to do it in the Custom CSS box it doesn't work – I must be targetting the wrong object. 我真的很想让这些标题居中–我使用内联样式进行管理,但是当我尝试在“自定义CSS”框中执行该操作无效时–我必须针对错误的对象。 Also, I really want to get rid of the full-width grey underline and just have a black underline on the heading. 另外,我真的想摆脱全角灰色下划线,而仅在标题上添加黑色下划线。

I am starting to see why using these premium Wordpress themes is a pain as they all do things differently... 我开始明白为什么使用这些优质的Wordpress主题会很痛苦,因为它们的处理方式各不相同...

Add this below your last declared CSS stylesheet at the bottom and you will get your headings to be aligned at the center . 将其添加到最后声明的CSS样式表的底部,您将使标题在center对齐。

.page-section div.heading h5, section.page-section .titleBar h2 {
    text-align: center;
}

WORKING DEMO 工作演示

Hope this helps. 希望这可以帮助。

.page-section .titleBar {
    text-align: center;
}

section.page-section .titleBar h2 {
    border-bottom: 1px solid #000000;
    padding: 0 0 5px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM