最窄770px最宽1024px的经典布局研究

最窄770px最宽1024px的经典布局研究aAwTechFeel最典型实用的上中下,并且中间分三列的,这个例子有2个特点: 1. 中间三列效果,可以任意实现单列背景色。aAwTechFeel2. 整体最窄770px,最宽1024px,也就是说窗口小于770xp就出底部滚动条,如果大于1024px自动屏幕居中。aAwTechFeel分析:最外层的wrapper把所有内容都嵌套在里边,整体相对。max min已经很好的控制了最窄最宽值,但对IE没有作用。如果没有其他的穿插,这一层其实写在body内就可以,少一层嵌套。aAwTechFeel#wrapper{ width:auto; border:1px solid #000; min-width:770px; max-width:1024px; text-align:left; margin-left:auto; margin-right:auto; position:relative;}wrapper 下级的 outer header footer其中header绝对,footer 相对;outer分别对左右有130px的外边距,这是兼容非IE的关键。aAwTechFeel#outer{ margin-left:130px; margin-right:130px; background:silver; border-left:1px solid #000; border-right:1px solid #000; color: #000;}aAwTechFeel#header{ position:absolute; top:0; left:0; width:100%; height:70px; line-height:70px; border-bottom:1px solid #000; overflow:hidden; background:#0ff; text-align:center; font-size:xx-large}aAwTechFeel#footer { width:100%; clear:both; line-height:50px; border-top:1px solid #000; background:#ffc; color:#000; text-align:center; position:relative;}outer 下级的 clearheader outerwrap right clearerclearheader 用做填补header的空白,clearer 是一个常用的填充hack用法。aAwTechFeelouterwrap 宽为什么是99%,而不是100%?因为他的上层outer有边框,100%宽再加2个边框象素就会撑大,FF有明显效果。aAwTechFeelright 的处理很经典,IE下解析为定位,FF下则为浮动。负边距的处理也刚好使用上outer留出的空白。aAwTechFeel#clearheader{ height:72px;}aAwTechFeel.outerwrap { float:left; width:99%;}aAwTechFeel#right {aAwTechFeelposition:relative;aAwTechFeelwidth:130px; float:right; left:1px;aAwTechFeelmargin-right:-129px;aAwTechFeel}aAwTechFeel* html #right { margin-right:-130px; margin-left:-3px}aAwTechFeel.clearer{ height:1px; overflow:hidden; margin-top:-1px; clear:both;}outerwrap 内的 centrecontent left clearer 就很简单了,思路类似上边说明。<!--[if gte IE 5]> 指定IE5.0及版本以上浏览器有效使用expression方法实现对IE5.0及以上版本的宽度条件控制。aAwTechFeelbody {width:expression( documentElement.clientWidth < 770 ? (documentElement.clientWidth == 0 ? (body.clientWidth < 770 ? "770" : "auto") : "770px") : "auto" );}aAwTechFeel#wrapper {width:expression( documentElement.clientWidth > 1024 ? (documentElement.clientWidth == 0 ? (body.clientWidth >1024 ? "1024" : "auto") : "1024px") : "auto" );}开始只想搞清楚老外是如何实现居中min max的,没想到最后是expression,太失望了,其实这里使用脚本控制更好。另外,老外原文的 Min width of 800px 是错的,CSS定义就是770px,后来截屏确认也是770px。总的来说这是一个很复杂的例子,融合了很多经典用法和定义,同时很传统和实用。类似的复杂,四层嵌套实现对于传统来说还是比较有优势的
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值