
The division tag <div> defines a section in an html document and we can deploy a very simple procedure to design a multi-column web page. This method is the modern way of creating such a website theme. We follow the following simple steps to create a multi-column web page.
- Create a parent <div> element
- Create child <div> elements under the parent <div>: These make up the columns
- Float the child <div> elements to the left apply some padding and some width
- Finally clear the floats
The number of child <div> elements will determine how many columns will be included in the web page. In a four column layout the parent <div> element will host four child <div> elements.
HTM-CSS THREE COLUMN LAYOUT
| THREE COLUMN LAYOUT |
| <!DOCTYPE html> <html lang=”en”> <head> <title>CSS Website Layout</title> <meta charset=”utf-8″> <meta name=”viewport” content=”width=device-width, initial-scale=1″> <style> * { box-sizing: border-box;} body {width:60%; margin: 50px auto; border:solid gray; border-width:2px; border-radius:5px; padding:5px; background:#333;} .head {padding: 5px;} .nav {width: 100%; margin:auto; text-align: center; padding:10px;} .nav a { font-size:16px; text-align:justify; font-weight:bold;text-decoration:none; padding: 10px 12px; color:#bbb;} .nav a:hover{color:skyblue;} .column {float: left; width: 25%; padding: 5px;} .row:after { content: “”; display: table; clear: both;} .footer{padding: 5px;text-align: center;} img{border:solid gray; border-width:1px; padding:5px; width:100%;} </style> </head> <body> <div class=”head”><img src = “image/0004.jpg”></div> <div class=”nav”> <a href=”#” >HONE</a> <a href=”#”>NIPA</a> <a href = “#”>APEX</a> <a href=”#”>CBU</a> <a href=”#”>UNZA</a> <a href=”#”>KATUNJILA</a> <a href=”#”>MULUNGUSHI</a> <a href=”#”>RIDGEWAY</a> </div> <div class=”row”> <div class=”column”><img src = “image/cv.jpg”></div> <div class=”column”><img src = “image/cv.jpg”></div> <div class=”column”><img src = “image/cv.jpg”></div> <div class=”column”><img src = “image/cv.jpg”></div> </div> <div class=”footer”><img src = “image/advertisement.jpg”></div> </body> </html> |
Notice that the parent <div> has four child <div> elements and each is set to a width of 25% floated to the left and given a padding of 10px and after that we clear the floats with css. These are the three main properties that you need to create a multi-column layout. When you get the layout right you can proceed to add more css to beautify your sight.
STUDENT FORUM FOR WEB TECHNOLOGY


