Block element
Will start with a new line
such as <p>
Inline elements
Does not start with a new line
<b><a>
div element (element type not specified)
(You can set the Div property by using an external index in the CSS file #divid{} to add a tag that needs to be modified before the curly braces)
<div id= "divID" >
span element (specifies that the element type is text type)
Div layout
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>div Layout </title>
<style type= "Text/css" >
Body {
margin:0px;
}
#container {
width:100%;
height:950px;
}
#heading {
width:100%;
height:10%;
}
#content_menu {
width:30%;
height:80%;
Float:left;
}
#content_body {
width:70%;
height:80%;
Float:left;
}
#footing {
width:100%;
height:10%;
Clear:both;
}
</style>
<body>
<div id= "Container" >
<div id= "Heading" > Head </div>
<div id= "Content_menu" > Content menu </div>
<div id= "Content_body" > Content theme </div>
<div id= "footing" > Bottom </div >
</div>
</body>
Table layout
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>table Layout </title>
<body marginheight= "0px" marginwidth= "0px" >
<table width= "100%" height= "950px" style= "
<tr>
<TD colspan= "2" width= "100%" height= "10%" style= "This is the head </td>
</tr>
<tr>
<TD width= "height=" 80% "style=" left menu </td>
<TD width= "height=" 80% "style=" right menu </td>
</tr>
<tr>
<TD colspan= "2" width= "height=" 10% "style=" Bottom </td>
</tr>
</table>
</body>
Block element Supplemental margin problem
<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>Title</title>
<body>
<!--padding internal margin margin--
<div style= "border:1px Red dashed;height:600px;width:800px;padding:10px;background-image:url (' CSS box model 3D hierarchy. PNG ') ">
<div style= "border:1px rgb (255,206,68) solid;height:200px;width:200px" >
</div>
<div style= "border:1px Blue solid;height:200px;width:200px;margin:10px;" >
<!--here because there is an inner margin of the outside Div so the margin 10px is now outside div20px-->
<div style= "margin:10px" >asdasdasdas</div>
</div>
</div>
</body>
HTML Learning Note block Element section III (original)