Home  >  Article  >  Web Front-end  >  How to lay out html

How to lay out html

墨辰丷
墨辰丷Original
2018-05-16 09:35:051700browse

This article mainly introduces how to layout html. Interested friends can refer to it. I hope it will be helpful to everyone.

  1. pLayout

<!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>
<p class="content">
<p class="left"></p>
<p class="right"></p>
</p>
<footer></footer>
</body>
</html>

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

3.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>
<!DOCTYPE html>  
<html>  
<head lang="en">  
    <meta charset="utf-8">  
    <title></title>  
    <style>  
        body{
        	margin: 0 auto;
        }
        table{
        	width: 100%;
        	height: 950px;
        	background: gray;
        	}		#header{			width: 100%;			height: 10%;			background: aqua;			}		#content{			width: 100%;			height: 80%;			background: blue;		}/**如果这里的父元素定了高度,子元素就不要定高度,然后table标签的属性在样式里面是不通用**/		.content_left{			width: 30%;			background: #f60;		}		.content_right{			width: 70%;			background: #fcc;		}		#footer{			width: 100%;			height: 10%;			background: aqua;		}
    </style>  
</head>  
  
<body>  
    <table  cellspacing="0" cellpadding="0" border="0">  
        <tr id="header">  
            <td colspan="2"><td>  
        </tr>
        <tr id="content">  
            <td class="content_left"><td>  
            <td class="content_right"><td>  
        </tr>
        <tr id="footer">  
            <td colspan="2"><td>  
        </tr>  
    </table>  
</body>    
</html>

Related Recommended:

Question: About a forum friend’s html layout implementation_html/css_WEB-ITnose

HTML layout calculator (div css)_html/ css_WEB-ITnose

, html layout problem. _html/css_WEB-ITnose

The above is the detailed content of How to lay out html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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