Use div to create a table layout : div table « Tags « HTML / CSS






Use div to create a table layout

 



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title></title>
        <style type='text/css'>
            div#container {
                border: thick dotted black;
                margin: 0 20px;
                background: red;
            }
            div#float {
                text-align: center;
                float: left;
                border: 1px solid black;
                width: 150px;
                height: 150px;
            }
            div.content {
                background: lightyellow;
                border: 1px solid black;
            }
            div#clear {
                border: 1px solid black;
                background: lightgreen;
                clear: both;   
            }
        </style>
    </head>
    <body>
        <div id='container'>
            <div id='float'>
                Float text. 
            </div>
                Content text. 
            <div class='content'>
                Content text.    
            </div>
                Content text.
            <div class='content'>
                Content text.
            </div>
                Content text.
            <div class='content'>
                Content text.
            </div>
                Content text.
            <div id='clear'>
                Clear text. 
            </div>
            <div>
                Another div.
            </div>
        </div>
    </body>
</html>

 








Related examples in the same category

1.Create DIV to create a table
2.Use DIV to create a table cell
3.A table but pure css
4.CSS table
5.Gallary layout