wordpress 主题的中心页脚

Center footer on wordpress theme

我目前正在创建一个网站并使用非常好的 Reykjavik 主题。首先,我创建了一个儿童主题。现在,我想对子主题做一些修改。 在此模板中,可以个性化页脚,但不能更改其位置。我提供用页面检查器检查它的位置,但没有找到任何东西...

我提供修改我的 style.css 子主题,将相对位置添加到页脚,但它没有改变任何东西..

请问您知道如何使页脚文本居中吗?

非常感谢:)

杰瑞

如果您将块元素居中

如果您试图将 <div><img> 等居中
W3Schools list of inline and block elements

您可能要考虑使用 margin: 0 auto;

.centered {
  margin: 0 auto;
  /*margin:0 auto: this gives the element a 0 top and bottom margin, and automatically sets the left and right to the maximum it can be*/
  width:100px;
  /*You need to specify a width for this to work*/
}
<div>
  <p class="centered">
    Hello World
  </p>
</div>

如果您将内联元素居中

对于行内元素,例如 <span><img> 或文本元素
W3Schools list of inline and block elements

为此,您可以使用 text-align:center;

.centered {
  text-align: center;
  /*Just tell the text to center itself in the element*/
}
<p class="centered">
  Hello World!
</p>

来源

W3Schools list of inline and block elements
CSS Tricks: Centering in CSS

我们在站点信息中添加边距 class: auto 然后文本居中。

.site-info { margin: auto }