- html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>title>
- <meta charset="utf-8" />
-
- <style>
- #div1 {
- width:300px;
- height:200px;
- background-color:springgreen;
- }
-
- #div2 {
- width:300px;
- height:200px;
- background-color:red;
- }
-
- style>
-
- head>
- <body>
-
- <div id="div1">
- div>
-
- <div id="div2">
- div>
-
- <div id="div3" style="width:400px;height:300px;border:2px solid red;background-
- color:#0000FF">
- 返回数据
- <div id="div4" style="width:300px;height:200px;border:2px solid red;background-
- color:red">
- div>
- div>
- body>
- html>
如下,
2个div是并列关系,互相独立,各自占据自己的区域;
如下,
是一个div包含另一个div,一个div将显示在另一个div的内部;