如何在博客模板中隐藏侧边栏时将内容居中?

时间:2016-02-13 13:48:06

标签: templates center blogger

在我的博客中,我只希望我的侧边栏显示在主页上,所以我在侧边栏小部件上使用了这些代码,使它们消失(http://www.codeitpretty.com/2013/11/how-to-show-and-hide-blogger-sidebar.html#comment-1621816088):

<b:if cond='data:blog.url == data:blog.homepageUrl'>
</b:if>

我获得了成功,但是侧边栏的空间仍然显示为so,所以现在我试图将内容集中在一起,我尝试使用padding-left和margin-left工作,但是当我制作时我的窗口较小,为了测试响应性,这个填充空间会扰乱布局。

所以我尝试了这个:

    <b:if cond='data:blog.url != data:blog.homepageUrl'>
<style>

.content-blog {
margin-left: 0%; 
}
.sidebar-footer #sidebar-wrapper{
display:none !important; 
}

</style>
</b:if>

但边栏仍在显示。 我希望你能帮我找到解决方案:)

1 个答案:

答案 0 :(得分:0)

固定!用以下内容代替上述内容:

<b:if cond='data:blog.url != data:blog.homepageUrl'>
<style>

#content {
padding-right:0;
}
.content-main {
float:none;
margin-top: 10px;
}
.content-blog {
padding-right:0;
}
#sidebar-wrapper {

float:none;
width:100%;
margin-top:60px;
}

</style>
</b:if>
相关问题