How to lay out a web page when writing html
There are two commonly used layouts in html. The first one is div layout, which has the advantage of being more convenient and concise, with less code, and easier to create and maintain. However, in some places, different browsers have different compatibility and may have different displays. The second type is the table layout, which has a lot of code and is very troublesome to maintain later. However, the table layout avoids many browser incompatibility issues.
1.div layout
<!DOCTYPE html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> <style> body{margin: 0; padding: 0;} #header{width:100%; height: 90px; background: #b19f9d; } #nav{margin: 0 auto; width:70%; height: 90px; background: #fcf;} .content{width: 950px; height: 900px; background: #847369; margin: 0 auto;} .left{width:30%; height: 900px; background: #decfd4; float: left;} .right{width: 70%; height: 900px; background: #b3a19d; float: left;} footer{width:100%; height: 150px; background: #a8817a;} </style> </head> <body> <header id="header"> <nav id="nav">空空</nav> </header> <div class="content"> <div class="left"></div> <div class="right"></div> </div> <footer></footer> </body> </html>
2.table layout
<!DOCTYPE html> <html> <head lang="en"> <meta charset="utf-8"> <title></title> <style> </style> </head> <body marginheight="0px" marginwidth="0px"> <table width="100%" height="950px" style="background-color:gray"> <tr> <td colspan="2" width="100%" height="10%" style="background-color: aqua" ><td> </tr> <tr> <td width="20%" height="80%" style="background-color: blue" ><td> <td width="80%" height="80%" style="background-color: blue" ><td> </tr> <tr> <td colspan="2" width="100%" height="10%" style="background-color: black" ><td> </tr> </table> </body> </html>
Summary:
The layout of table is relatively limited, while div is more open, with more design styles and beautiful effects. The advantage of table is that all browsers are compatible with div. The disadvantage of div is that compatibility is very troublesome.
Related recommendations:
HTML layout calculator (div css)_html/css_WEB-ITnose
html layout problem. _html/css_WEB-ITnose
##HTML layout_html/css_WEB-ITnose
htmlLayout problem_html/css_WEB-ITnose
The above is the detailed content of How to lay out a web page when writing html. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
