如何用div+css制作一个表格
1个回答
展开全部
以下是更改内容:
<!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=utf-8" />
<title>无标题文档</title>
<style>
#table{
float:left;
width:800px;
border-left:#999999 1px solid;
border-top:#999999 1px solid;
}
#table li{
float:left;
width:399px;
list-style:none outside;
border-bottom:#999999 1px solid;
border-right:#999999 1px solid;
text-align:center;
}
#table div{
float:left;
}
.left{
width:100px;
border-right:#999999 1px solid;
}
.right{
width:298px;
}
</style>
</head>
<body>
<div id="table">
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
<li>
<div class="left"激汪>123</div>
<div class="right">123</div>
</li>
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
</div>
</body>
</html>
在<li></li>标宴散签里加了<div></div>
设置<style></style>里的.left和.right的width就可以,399的宽度=.left的宽度+.right的宽度+1
<!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=utf-8" />
<title>无标题文档</title>
<style>
#table{
float:left;
width:800px;
border-left:#999999 1px solid;
border-top:#999999 1px solid;
}
#table li{
float:left;
width:399px;
list-style:none outside;
border-bottom:#999999 1px solid;
border-right:#999999 1px solid;
text-align:center;
}
#table div{
float:left;
}
.left{
width:100px;
border-right:#999999 1px solid;
}
.right{
width:298px;
}
</style>
</head>
<body>
<div id="table">
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
<li>
<div class="left"激汪>123</div>
<div class="right">123</div>
</li>
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
<li>
<div class="left">123</div>
<div class="right">123</div>
</li>
</div>
</body>
</html>
在<li></li>标宴散签里加了<div></div>
设置<style></style>里的.left和.right的width就可以,399的宽度=.left的宽度+.right的宽度+1
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询