这是 post.html 的 css:
/* Space out content a bit */
body {
padding-top: 20px;
padding-bottom: 20px;
}
/* Everything but the jumbotron gets side spacing for mobile first views */
.header,
.marketing,
.footer {
padding-right: 15px;
padding-left: 15px;
}
/* Custom page header */
.header {
border-bottom: 1px;
}
/* Make the masthead heading the same height as the navigation */
.header h3 {
margin-top: 0;
margin-bottom: 0;
line-height: 40px;
}
/* Custom page footer */
.footer {
padding-top: 19px;
color: #777;
border-top: 1px solid #e5e5e5;
}
/* Customize container */
@media (min-width: 768px) {
.container {
max-width: 60%;
}
}
.container-narrow > hr {
margin: 30px 0;
}
.jumbotron {
border-bottom: 1px solid #e5e5e5;
}
.jumbotron .btn {
padding: 14px 24px;
font-size: 21px;
}
.marketing {
margin: 40px 0;
}
.marketing p + h4 {
margin-top: 28px;
}
@media screen and (min-width: 768px) {
/* Remove the padding we set earlier */
.header,
.marketing,
.footer {
padding-right: 0;
padding-left: 0;
}
/* Space out the masthead */
.header {
margin-bottom: 30px;
}
/* Remove the bottom border on the jumbotron for visual effect */
.jumbotron {
border-bottom: 0;
}
}
如何添加侧边栏? max-width 属性负责页面中心的主要内容。如何向边添加内容? Float:right 不起作用 right float 的内容位于中心内容的右侧,而不是页面的右侧。
最佳答案
我不确定你所说的侧边栏是指隐藏菜单还是右栏。
右栏:
<div id="rightColumn">
stuff goes here...
</div>
和
div#rightColumn
{
float: right;
right: 15px;
width: 150px;
}
...是一种方式。右栏 div 在 HTML 正文中,不在任何主要内容区域 div 中;我怀疑你有它在里面,这会导致你看到的行为。
如果是隐藏菜单,则需要 Javascript;见http://semantic-ui.com/modules/sidebar.html#/examples .但是您没有将其作为标签,所以我假设您指的是右列或左列。
关于html - 如何添加侧边栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26023895/