【代码片段】混合布局
来源:互联网 发布:手机淘宝店怎么改店名 编辑:程序博客网 时间:2024/06/07 19:13
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>混合布局</title> //一列+两列<style>body{ margin:0; padding:0; font-size:30px; font-weight:bold}div{ text-align:center; line-height:50px}.head{ height:100px;background:#9CF}.left{ width:20%; height:600px; background:#ccc; float:left}.right{ width:80%; height:600px;background:#FCC; float:right}</style></head><body><div class="head">head</div><div class="left">left</div><div class="right">right</div></body></html>
</pre><pre name="code" class="html"><pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>混合布局</title> //固定宽度的一列+两列<style>body{ margin:0; padding:0; font-size:30px; font-weight:bold}div{ text-align:center; line-height:50px}.head, .main, .footer{ width:960px; margin:0 auto}.head{ height:100px;background:#9CF}.left{ width:240px; height:600px; background:#ccc; float:left}.right{ width:720px; height:600px;background:#FCC; float:right}.footer{ height:50px; background:#9F9; clear:both}</style></head><body><div class="head">head</div><div class="main"> <div class="left">left</div> <div class="right">right</div></div><div class="footer">footer</div></body></html>
</pre><pre name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>混合布局</title> //一列+三列布局(本是两列,右边列再被分为两列)<style>body{ margin:0; padding:0; font-size:30px; font-weight:bold}div{ text-align:center; line-height:50px}.head, .main, .footer{ width:960px; margin:0 auto}.head{ height:100px;background:#9CF}.left{ width:220px; height:600px; background:#ccc; float:left}.right{ width:740px; height:600px;background:#FCC; float:right}.r_sub_left{ width:540px; height:600px; background:#9C3; float:left}.r_sub_right{ width:200px; height:600px; background:#9FC; float:right}.footer{ height:50px; background:#9F9; clear:both}</style></head><body><div class="head">head</div><div class="main"> <div class="left">left</div> <div class="right"> <div class="r_sub_left">sub_left </div> <div class=" r_sub_right">sub_right </div> </div></div><div class="footer">footer</div></body></html>
清除浮动有两种方法:1.clear:both 2.overflow:hidden,常用于footer</span><pre>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>混合布局</title> //main是left和right的下面底色<style type="text/css">body{ margin:0; padding:0; font-size:30px; color:#fff}.top{height:100px;background:#ccc;}.main{background:red;position:relative;height:500px;}.left{width:200px;height:500px;background:blue;position:absolute;top:0;}.right{margin:0 0 50px 210px;background:#9C9;height:500px;}.foot{height:50px;background:#f63;}</style></head><body><div class="top">top</div><div class="main"> <div class="right">right</div> <div class="left">left</div></div><div class="foot">foot</div></body></html>
0 0
- 【代码片段】混合布局
- 【代码片段】一列布局
- 【代码片段】两列布局
- 【代码片段】三列布局
- Android布局常用代码片段
- CSS常见布局代码片段
- android xml和代码混合布局要点
- XIB混合代码来实现布局
- XIB混合代码来实现布局
- 代码片段
- 代码片段
- 代码片段
- 代码片段
- 片段代码
- 代码片段
- 代码片段
- 代码片段
- 代码片段
- Nginx 502 Bad Gateway 错误的原因及解决方法
- Window下Eclips用Maven构建Hadoop项目
- LeetCode-Combination Sum
- c语言程序设计(第1讲)关键字
- 深入理解 java 虚拟机笔记 -01
- 【代码片段】混合布局
- 文章标题
- DNS的查找机制、中文扩展,及其对手机扫描商标名称的支持
- vs2013 以上的实用小功能-将xml,json自动转换为class
- PAT 1002. A+B for Polynomials
- adb shell:fail to startdeamon
- JAX-WS开发的webservice如何在Tomcat下发布
- 小码哥第三天笔记
- Eclipse搭建Spring环境