CSS + Div layout (1)-CSS + Div implement table layout

Source: Internet
Author: User

CSS + Div implement table layout

CSSCode

< Style >
. 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 >

Set border-left and border-top for each cell. Such cells are combined into rows, and only the bottom border of the last and last row is missing. Special processing is required, therefore, two other classes are defined: lastcell and lastrow. The final table border will not overlap.
Class: grid_rw1clr and grid_rw2clr achieve alternating colors

CSS table Effect
Header (1, 1) header (1, 2) Row (1, 1) Row (1, 2) Row (2, 2)

HTML code   < Div Class = " Table " >
< Div Class = " Header " > < Div > Header ( 1 , 1 ) </ Div > < Div Class = " Lastcell " > Header ( 1 , 2 ) </ Div > </ Div >
< Div Class = " Row grid_rw1clr " > < Div > Row ( 1 , 1 ) </ Div > < Div Class = " Lastcell " > Row ( 1 , 2 ) </ Div > </ Div >
< Div Class = " Row grid_rw2clr lastrow " > < Div > Row ( 2 , 1 ) </ Div > < Div Class = " Lastcell " > Row ( 2 , 2 ) </ Div > </ Div >
</ Div >

Next we need to implement:

    • Sort
    • Drag
    • Stretch
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.