用div和css样式控制页面布局
2016-05-30 00:00
603 查看
1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 <title>网页布局练习</title> 6 7 <link href="../EX_Asp_Net/css/div.css" rel="stylesheet" /> 8 </head> 9 <body> 10 <h1 align="center">利用div和css对页面的布局进行调整</h1><hr /> 11 <div class="d1"> 12 <h3>窗口1</h3> 13 </div> 14 <div class="d2"><h3>窗口2</h3></div> 15 <div class="d3"><h3>窗口3</h3></div> 16 </body> 17 </html>
css代码:
1 bod { 2 margin:100%; 3 padding:100%; 4 5 } 6 .d1{ 7 width:200px; 8 height:600px; 9 background-color:red; 10 margin-left:20px; 11 margin-top:20px; 12 position:absolute; 13 } 14 .d2{ 15 width:800px; 16 height:150px; 17 background-color:greenyellow; 18 position:absolute; 19 left:235px; 20 margin-top:20px; 21 22 } 23 .d3{ 24 width:800px; 25 height:420px; 26 position:absolute; 27 left:235px; 28 background-color:#19a1f8 ; 29 margin-top:200px; 30 31 }
![](http://static.oschina.net/uploads/img/201605/30225415_sv7i.png)
相关文章推荐
- 用div和css样式控制页面布局
- 用div和css样式控制页面布局
- 用div和css样式控制页面布局
- JAVA WEB <s:form>提交样式改变,不受控制
- 关于团队合作的css命名规范
- absolute与relative
- CSS盒子模型
- CSS中position属性的总结使用
- B/S之CSS简介
- CSS background 属性
- CSS浏览器适配设置
- 【css】选择器+盒子模型
- html/css
- css
- 纯css3 开关按钮
- CSS3 Transition
- [译]CSS-理解百分比的background-position
- 浏览器兼容的css hack
- JS对父元素和子元素样式设置及Iframe子页面装载
- CSS实现div垂直居中 div上下居中显示