Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress 页眉因填充而向右移动_Wordpress_Header_Center_Padding - Fatal编程技术网

Wordpress 页眉因填充而向右移动

Wordpress 页眉因填充而向右移动,wordpress,header,center,padding,Wordpress,Header,Center,Padding,我希望我在Wordpress中的标题在正文内容中居中。现在,页面id Div的左右边距都为40px。在Header.php中添加宽度为960+40+40=1040的“我的标题”时,标题在正文内容中居中,但由于左侧有填充,因此右边有40个像素 我将标题放在 我的标题如何在正文内容中完全居中,而不受填充的影响 网址为: 您的想法是正确的,但在指定边距的代码中存在语法错误: 你有: 但它应该是: style=“左边距:-40px” 如果您内联使用它,或者如果您将它放在CSS样式表中,则只使用左边距

我希望我在Wordpress中的标题在正文内容中居中。现在,页面id Div的左右边距都为40px。在Header.php中添加宽度为960+40+40=1040的“我的标题”时,标题在正文内容中居中,但由于左侧有填充,因此右边有40个像素

我将标题放在

我的标题如何在正文内容中完全居中,而不受填充的影响

网址为:


您的想法是正确的,但在指定边距的代码中存在语法错误:

你有:

但它应该是:
style=“左边距:-40px”

如果您内联使用它,或者如果您将它放在CSS样式表中,则只使用
左边距:-40px

希望这有帮助

  media="all"
@media screen and (min-width: 960px)
body .site {
  padding: 0 40px;
  padding: 0 2.857142857rem;
  margin-top: 0px;
  margin-bottom: 48px;
  margin-bottom: 3.428571429rem;
  box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);