中心整个博客和侧边栏(Wordpress主题)

时间:2018-05-03 09:08:40

标签: css wordpress-theming

我正在尝试设计我的WordPress主题(并且是一个全新手),而我在整个博客中心时遇到了麻烦。 For reference, this is what it looks like now.

过去所有东西都正确居中,然后我改变了整个博客的宽度,然后突然菜单没有占用最大宽度,博客和侧边栏不再居中。我很乐意为此提供帮助。提前致谢! :)

以下是我为博客提供的代码:

div#container
{
    margin: 0px auto;
    width: 1050px;
    min-width: 1050px;
    max-width: 1050px
}

div#content
{
    max-width: 640px;
    margin-right: auto !important;
    margin-left: auto!important;
    margin-bottom: 30px;
    float: left;
    padding: 30px 30px 30px 30px;
    background-color: white!important;
}

侧边栏:

div#primary
{
    /* Primary Widget Area DIV */
    padding: 10px 25px 30px 25px !important;
    margin: 0px auto!important;
    float:right;
    background-color: white!important;
    max-width: 260px!important;
}

菜单:

.menu {
    background-color: #676565;
    margin: 0px auto;
    width: 100%!important;
    list-style: none;
    padding: 10px 10px 10px 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-family: 'Tw Cen MT'!important;
    position: relative;
}

2 个答案:

答案 0 :(得分:0)

您可以尝试设置正文标记样式作为问题的快速解决方案。

示例如下,



html{
background-image: url("https://i.imgur.com/urEcvAw.png"); background-position: center center; background-size: 200px!important; background-size: cover; background-repeat: repeat; background-attachment: fixed; margin: 0;
}

body{
 max-width:160px;
 margin:0 auto;
 background:#fff;
}

.sample{
 text-align:center;
 background:#fff;
 height:80px;
 width:100%;

}

<html>
<head>
</head>
 <body>
    <div class="container sample">
       <p>here all websites header, main block footer comes.. </p>
    </div>
 </body>
</html>
&#13;
&#13;
&#13;

希望它对你有帮助..

答案 1 :(得分:0)

您的.menu课程设为position:relative;

因此,您必须在.menu类中添加以下行:

left:0; right:0; margin:auto; width:100%;

我相信这可以解决你的问题。