html - CSS定位

标签 html css wordpress

试图搞乱这个 WordPress 主题,但无法弄清楚为什么侧边栏堆叠在内容 block 下方。任何帮助将不胜感激。 http://www.buffalostreetbooks.com/events

CSS:

body {
    font-family: Arial, Helvetica, Verdana, Sans-serif;
    font-size: 10pt;
    background-color: #692022;
    background-image:url("http://www.buffalostreetbooks.com/wp-content/themes/autumn-leaves/images/repeatflower.png");
}

body,h1#blog-title {
    margin: 0;
    padding: 0;
}

a {
    color: blue;
}

a:hover {
    color: #FF8C00;
}

a img {
    border: 0 none;
}

#wrapper {
    width: 960px;
    margin: 0 auto;
    background-color: #F4FBF4;
    border-left: 1px solid #ccc;
    border-right: 1px solid #ccc;
}

#header {
    background-image:url("http://www.buffalostreetbooks.com/wp-content/themes/autumn-leaves/images/headertime.png");
    width:768px;
    height: 200px;
}

#inner-header {
    padding: 125px 1em 0;
}

h1#blog-title {
    font-size: 2em;
}

h1#blog-title a {
    color: #800000;
}

.entry-title a {
    color: #CD853F;
}

h1#blog-title a, .entry-title a, #footer a {
    text-decoration: none;
}

h1#blog-title a:hover, .entry-title a:hover, #footer a:hover {
    text-decoration: underline;
}

div.skip-link {
    display: none;
}

#menu {
    border-bottom: 1px solid #ccc;
}

#menu a {
    color: #000;
}

#menu a:hover {
    text-decoration: underline;
}

#menu li.current_page_item a, #menu li.current_page_item a:hover {
    background-color: #DFC28B;
    text-decoration: none;
}

#content {
    padding: 1em;
    width:600px;
}

.entry-title {
    font-size: 1.5em;
    margin: 1em 0 0 0;
}

abbr.published {
    color: #666;
    border: 0 none;
}

.entry-meta, .entry-date {
    color: #666;
}

#comments-list .avatar {
    float: left;
    margin-right: 1em;
}

#comments-list .n {
    font-weight: bold;
}

.entry-meta, .comment-meta {
    font-style: italic;
}

#comments-list p {
    clear: left;
}

#primary {
    padding-left: 1em;
    font-size: 0.9em;
    border-left: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    background-color: #FFFACD;
}

#footer {
    text-align: center;
    font-size: 0.8em;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    margin-bottom: 1em; 
}

#inner-footer {
    padding: 1em 0;
}

.entry-meta, .entry-meta a,
.comment-meta, .comment-meta a,
.sidebar, .sidebar a,
#footer, #footer a {
    color: #666;
}

/*
LAYOUT: Two-Column (Right)
DESCRIPTION: Two-column fluid layout with one 

sidebars right of content
*/
div#container {

margin:0 0 0 0;
width:960px;
height:100%;
}

div#content {
margin:0 0 0 0;
}

div.sidebar {

overflow:hidden;
width:280px;
min-height:500px;
clear:both;
}

div#secondary {
clear:right;
}

div#footer {
clear:both;
width:100%;
}

/* Just some example content */
div#menu {
height:2em;
width:100%;
}

div#menu ul,div#menu ul ul {
line-height:2em;
list-style:none;
margin:0;
padding:0;
}

div#menu ul a {
display:block;
margin-right:1em;
padding:0 0.5em;
text-decoration:none;
}

div#menu ul ul ul a {
font-style:italic;
}

div#menu ul li ul {
left:-999em;
position:absolute;
}

div#menu ul li:hover ul {
left:auto;
}

.entry-title,.entry-meta {
clear:both;
}

div#primary {

}

form#commentform .form-label {
margin:1em 0 0;
}

form#commentform span.required {
background:#fff;
color:#c30;
}

form#commentform,form#commentform p {
padding:0;
}

input#author,input#email,input#url,textarea#comme

nt {
padding:0.2em;
}

div.comments ol li {
margin:0 0 3.5em;
}

textarea#comment {
height:13em;
margin:0 0 0.5em;
overflow:auto;
width:66%;
}

.alignright,img.alignright{
float:right;
margin:1em 0 0 1em;
}

.alignleft,img.alignleft{
float:left;
margin:1em 1em 0 0;
}

.aligncenter,img.aligncenter{
display:block;
margin:1em auto;
text-align:center;
}

div.gallery {
clear:both;
height:180px;
margin:1em 0;
width:100%;
}

p.wp-caption-text{
font-style:italic;
}

div.gallery dl{
margin:1em auto;
overflow:hidden;
text-align:center;
}

div.gallery dl.gallery-columns-1 {
width:100%;
}

div.gallery dl.gallery-columns-2 {
width:49%;
}

div.gallery dl.gallery-columns-3 {
width:33%;
}

div.gallery dl.gallery-columns-4 {
width:24%;
}

div.gallery dl.gallery-columns-5 {
width:19%;
}

div#nav-above {
margin-bottom:1em;
}

div#nav-below {
margin-top:1em;
}

div#nav-images {
height:150px;
margin:1em 0;
}

div.navigation {
height:1.25em;
}

div.navigation div.nav-next {
float:right;
text-align:right;
}

div.sidebar h3 {
font-size:1.2em;
}

div.sidebar input#s {
width:7em;
}

div.sidebar li {
list-style:none;
margin:0 0 2em;
}

div.sidebar li form {
margin:0.2em 0 0;
padding:0;
}

div.sidebar ul ul {
margin:0 0 0 2em;
}

div.sidebar ul ul li {
list-style:disc;
margin:0;
}

div.sidebar ul ul ul {
margin:0 0 0 0.5em;
}

div.sidebar ul ul ul li {
list-style:circle;
}

div#menu ul li,div.gallery dl,div.navigation 

div.nav-previous {
float:left;
}

input#author,input#email,input#url,div.navigation 

div {
width:50%;
}

div.gallery *,div.sidebar div,div.sidebar 

h3,div.sidebar ul {
margin:0;
padding:0;
}

最佳答案

那么,在容器 div 内,您可以交换两个 div 的位置(侧边栏和内容),然后使侧边栏 div float :向左。

如果您不想移动内容,只需更改 CSS 即可实现。 使 div#content float :右 使 div#sidebar float :向左 在 div.sidebar 规则下删除clear:both

关于html - CSS定位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2663312/

相关文章:

php - WordPress 自定义查询不返回结果

javascript - 如何在自定义 Polymer Web 元素中查询动态注入(inject)的光子元素?

javascript - 圆圈周围的链接文本

html - 针对平板电脑和手机的媒体查询

html - 如何扩大下拉菜单的大小

mysql - SQL 表在 PhpMyAdmin 上是垂直列出的,而不是水平列出的

javascript - 如何从 JSON JavaScript 返回普通字符

javascript - 视频循环性能不佳

javascript - 功能检测自动播放 HTML5 音频 - 移动浏览器上的音频

css - Xss 跨站脚本实践