css+div 布局(1)- css+div实现table布局_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:33:29
Original
1438 people have browsed it

css+div实现table布局

css代码


.table /**/ /*div table container*/
{



/**//*width:770px;*/
}
.row div /**/ /*div row cell*/
{
display:inline;
width:240px;
border-top:1px solid  #C1BBAB;
border-left:1px solid #C1BBAB;
}
.header div /**/ /*div header cell*/
{
display:inline;
width:240px;
border-top:1px solid  #C1BBAB;
border-left:1px solid #C1BBAB;
text-align:center;
background-color:#E0DDD5;
}
.lastcell /**/ /*last cell*/
{
border-right:1px solid #C1BBAB;
}
.header /**/ /*div table hearder*/
{
font:bold;
color:navy;
}
.grid_rw1clr div /**/ /*cell in grid_rw1clr*/
{
    background-color: #FFFFFF;
}
.grid_rw2clr div /**/ /*cell in grid_rw1clr*/
{
    background-color: #F9F8F6;
}
.row
{
font:normal 12px;
}
.lastrow div /**/ /*cell in last row*/
{
border-bottom:1px solid #C1BBAB;
}
style >

对每个cell设置border-left,border-top,这样的单元格拼成行,仅仅缺少最后一格右边框和最后一行的底边框,这些就需要特殊处理,所以另外定义两个class:lastcell和lastrow来处理,最后拼出来的table边框就不会有重叠。
class:grid_rw1clr,grid_rw2clr实现交替色

Css Table效果

header(1,1)

header(1,2)

row(1,1)

row(1,2)

row(2,1)

row(2,2)

Html代码

 
   header( 1 , 1 ) div > header( 1 , 2 ) div > div >
   row( 1 , 1 ) div > row( 1 , 2 ) div > div >
   row( 2 , 1 ) div > row( 2 , 2 ) div > div >
div >


接下来还需要实现:
排序 拖拽 拉伸
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!