利用css实现两列等高的方法
来源:互联网 发布:js throw exception 编辑:程序博客网 时间:2024/05/17 04:20
1:利用负边距
<style type="text/css">
.container{
width:980px
background: pink;
overflow:hidden;
}
/*清楚浮动*/
.clearfloat{
zoom:1;
}
.clearfloat:after{
display:block;
clear:both;
content:"";
height: 0;
line-height: 0;
visibility: hidden;
}
/*清楚浮动*/
.mainbox{
width:650px;
float:left;
background: red;
margin-bottom:-9999px;
padding-bottom:9999px;
}
.sidebox{
width:280px;
float: right;
background: green;
margin-bottom:-9999px;
padding-bottom:9999px;
}
</style>
2:利用背景图片在Y方向重复
<style type="text/css">
.container{
width:980px
background: url(images/a.png) repeat-y 0 0;
}
/*清楚浮动*/
.clearfloat{
zoom:1;
}
.clearfloat:after{
display:block;
clear:both;
content:"";
height: 0;
line-height: 0;
visibility: hidden;
}
/*清楚浮动*/
.mainbox{
width:650px;
float:left;
}
.sidebox{
width:280px;
float: right;
</style>
3:利用边框模拟(定位元素的高度不能大于非定位元素的高度)<style type="text/css">
.container{
width:980px;
positin:relative;
}
/*清楚浮动*/
.clearfloat{
zoom:1;
}
.clearfloat:after{
display:block;
clear:both;
content:"";
height: 0;
line-height: 0;
visibility: hidden;
}
/*清楚浮动*/
.mainbox{
width:650px;
float:left;
background: red;
border-right:280px solid green;
}
.sidebox{
width:280px;
position:absolute;
top:0;
right:0;
}</style>
div class="container clearfloat">
<div class="mainbox">主要</div>
<div class="sidebox">侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏侧边栏</div>
</div>
- 利用css实现两列等高的方法
- 实现两(三)列等高布局的方法
- 三种纯CSS方法实现等高列
- 三种纯css方法实现等高列
- 两列等高布局的实现
- CSS----实现div两列(左/右)等高
- div实现两列等高
- 两列等高布局 padding+margin的负值 CSS布局奇淫技巧之-多列等高
- 两列等高
- CSS利用padding和margin正负相消实现多列等高
- 两列或多列等高布局实现
- 实现两列等宽布局的几种方法
- CSS实现三列自适应的两种方法
- 两列等高布局
- CSS 多列等高
- 解决等高列的方法
- CSS实现已知宽高的div垂直居中;自适应高度两列布局
- 探索CSS实现三行三列等高布局
- tomcat报错
- win系统怎么合并PDF文件
- C++和Java中字符串操作
- iOS 9.3真机适配-Could not find Developer Disk Image问题
- 网络基础知识(一)
- 利用css实现两列等高的方法
- Android图文混排
- 手把手教你在ubuntu下创建桌面快捷方式
- 数字签名和数字信封的区别
- 拉格朗日对偶性
- W7x64下Mysql5.7.11配置
- IT 自己喜欢的学习网站
- hbase压缩算法-Snappy算法安装
- 冒泡排序的简单实现