html - CSS Positions 和 floats 一切都在叠加

标签 html css positioning css-float

您好,由于某种原因,我的 css 有问题,我无法在另一个 div 下获取一个 div,所以这是我的代码

现场演示 adamlisik.co.uk/kantor2 这是我的 CSS

body{
margin: 0;
font-family: Arial, sans-serif;
font-size: 13px;
line-height: 18px;
padding:0px;
background-image:url('../images/bg-body.jpg');
background-attachment:fixed;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: inherit;
  font-weight: bold;
  color: inherit;
  }
h1 {
  font-size: 30px;
  line-height: 36px;
}
h2 {
  font-size: 24px;
  line-height: 36px;
}
h3 {
  line-height: 27px;
  font-size: 18px;
}
h4,
    h5,
h6 {
  line-height: 18px;
}
h4 {
  font-size: 14px;
}
h5 {
  font-size: 12px;
}
h6 {
  font-size: 11px;
  color: #999999;
  text-transform: uppercase;
}
p {
  margin: 0 0 9px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  line-height: 18px;
    color:#0d0d0d;
}
hr{ border:none; height:1px; margin:30px 0; background-color:#CCCCCC; color:#CCCCCC; }
    .hr{ border-top:1px solid #CCCCCC; margin:30px 0; }
.container {
width:1000px;
margin: auto;
padding:0px;
background:#FFF;
}
.header { 
position:relative; 
z-index:10; 
background-image:url('../images/logo1.jpg');
background-repeat:no-repeat;
background-position:left bottom; 
height:100px;
width:950px;
margin:auto;

}

ul#dropdown-menu{  float:right; list-style:none; margin-bottom:0px; padding-top:70px; }       
ul#dropdown-menu li{ float: left; }
ul#dropdown-menu li a{ display: block; padding:7px 21px 5px 0; font-size:16px; text-transform:none; color:#252525;text-decoration:none; font-weight:bold; }            
ul#dropdown-menu li a:hover{ color:#FF0000;}
ul#dropdown-menu li.hover a{ text-decoration:underline;  }           
ul#dropdown-menu li.current > a{ color: #FF0000; }                             
ul#dropdown-menu li .sub-menu li a{ color:#252525; }                               
ul#dropdown-menu li.last > a{ padding-right:0px; }

.money {
    margin-top:20px;
    background-image:url('../images/hr-bg.jpg');
    height:120px
}

.content {
padding:25px 50px 10px;
}

.footer {
padding:5px 15px 10px;
}

现在,只要您在 css 中添加接下来的两个类,就可以让表格转到另一边

 .left {
float:left;
}
.right {
float:right;}

一切都在变化,hr 在表格之上,所有页脚样式都不起作用

知道如何解决这个问题吗?

最佳答案

当您将 float 属性添加到一个元素时,它会从正常流中移除,因此它的父元素(仍在正常流中)的行为就好像 float 元素不再是它的子元素一样.

你可以这样解决:

.hr{ clear: both; }

希望对您有所帮助。

关于html - CSS Positions 和 floats 一切都在叠加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10484831/

相关文章:

html - Internet Explorer 的目录上传

javascript - 当您键入时文本字段发生变化时更改跨度

javascript - JQuery 将一个元素设置在另一个元素的中间

css - 当html文档中有多个图像时如何定位图像

html - 并排显示 :inline-block elements, 到父级?

javascript - 使用 javascript 切换 bool 值以获得暗模式功能

html - 如何使用 CSS 在同一行中制作两条垂直线

html - 如何使用CSS设置缩放级别

jquery - 如何将类添加到幻灯片中的当前图像?

固定社交按钮 div 相对于另一个 div 或容器的 CSS 定位