如何用css设置表格跳页

html-css017

如何用css设置表格跳页,第1张

在网页中用css+div实现表格效果,首先我们需要理解的就是div是一个块级元素,可以在里面包裹其他的div,通过给这些div这是不同的高度,宽度,还有一些float属性,就可以实现如同表格一样的布局,具体看代码来理解下:

<!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/htmlcharset=utf-8" />

<link rel="stylesheet" type="text/css" href="CSS-kuaidu.css"/>

<title>宽度的学习</title>

</head>

<body>

<div style="width:960pxheight:700pxmargin:0 autoborder:solid 1px #999999" >

<div style="width:960pxheight:25pxborder:solid 1px #CCCCCC">

导航条

</div>

<div style="width:960pxheight:80pxborder:solid 1px #CCCCCC">

店铺图片

</div>

<div style="width:200pxheight:400pxborder:solid 1px #CCCCCCfloat:left">

左侧目录

</div>

<div style="width:750pxheight:400pxborder:solid 1px #CCCCCCfloat:right">

右侧内容

</div>

<div style="width:960pxheight:17pxborder:solid 1px #CCCCCCfloat:left">

尾区

</div>

<div style="width:960pxheight:173px border:solid 1px #CCCCCCfloat:left">

尾招

</div>

</div>

</body>

</html>

1、两个表格定义不同的class,通过class设定不同的样式

如<style>

.a{border:2px}

.b{border:10px}

</style>

2、两个表格定义不同的id,通过id设定不同的样式

如<style>

#a{border:2px}

#b{border:10px}

</style>

<style type="text/css">

li{

width:20px

height:20px

text-align:center

line-height:20px

border:1px solid #ccc

margin-left:5px

list-style-type:none

cursor:pointer

float:left

}

li:hover {

border:none

}

</style>

<ul>

<li>1</li>

<li>2</li>

<li>3</li>

<li>4</li>

<li>5</li>

</ul>

这个是符合web标准的,但是IE6不兼容,如果需要兼容IE6,可以加个javascript脚本控制