您的位置:首页 > Web前端 > CSS

DIV+CSS实现表格功能

2012-12-11 09:38 274 查看
DIV+CSS实现表格功能

除去(IE6、IE7)不支持不支垂直居中功能已基本实现

http://332374363.blog.51cto.com/5262696/1082748

http://332374363.blog.51cto.com/5262696/1082800

两者代码的结合(css hack)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

<style type="text/css">

<!--

* {

font:12px 宋体;

}

.ul_table {

display:table;

width:933px;

border-left:#B0B9D1 solid 1px;

border-bottom:#B0B9D1 solid 1px;

padding:0;

*overflow:hidden;

}

.ul_table ul {

display:table-row;

list-style-type:none;

margin:0;

padding:0;

*clear:both;

}

.ul_table ul li {

display:table-cell;

line-height:24px;

border-right:#B0B9D1 solid 1px;

border-top:#B0B9D1 solid 1px;

margin:0;

padding:5px;

*padding-bottom:100px;

*margin-bottom:-95px;

*float:left;

}

.one {

width:200px;

text-align:center;

vertical-align:middle;

}

.two {

width:500px;

word-wrap:break-word;

overflow: hidden;

}

.three {

width:200px;

text-align:center;

}

.four {

width:711px;

word-wrap:break-word;

overflow: hidden;

*background:#FFFFFF;

}

#border_0 {

border-top-width:0px;

}

-->

</style>

</head>

<body>

<div class="ul_table">

<ul>

<li class="one">编号</li>

<li class="two">内容</li>

<li class="three">日期</li>

</ul>

<ul>

<li class="one">001</li>

<li class="two">内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three</li>

<li class="three">2012-12-3 14:02:09</li>

</ul>

</div>

<div class="ul_table">

<ul>

<li class="one" id="border_0">001</li>

<li class="four" id="border_0">内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three内容one\two\three</li>

</ul>

</div>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  CSS DIV 表格