当前位置: 首页 > 图文教程 > 网页制作 > CSS样式表 > YUI 中的 Grids CSS值得关注和学习的

CSS样式表
css 兼容ie6,ie7,ff的fixed,元素上下端固定定位方法
CSS解决链接锚点定位偏移的代码
一个css transform效果 很有图片的感觉
ie6,ie7,firefox的textarea滚动条、边框
12种CSS BUG解决方法与技巧
CSS 常用设置备忘
table中td内容换行问题
外部引用CSS中 link与@import的区别
CSS background-position 属性 定位图片
css 解决英文字符与阿位伯数字自动换行
div ,frame等空间的透明实现代码
CSS中几种浏览器对不同版本的支持与区分写法
多个浏览器对容器宽度实际像素的解释
CSS 用ul li做圆角表格
CSS 之dl dt dd模拟表格实例代码
创建超链接及css 样式设置
页面位置 top、postop、scrolltop、offsetTop、scrollHeight、offsetHeight、clientHe
css float 解析学习
学习DIV+CSS难不难 需要掌握哪些知识
IE8 CSS hack

CSS样式表 中的 YUI 中的 Grids CSS值得关注和学习的


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 99 ::
收藏到网摘: n/a


YUI 中的 Grids CSS 主要有三个部分值得大家关注和学习:
1、布局的思想:使用 “负 margin(Negative Margins)” 技术
详细可参阅:《Creating Liquid Layouts with Negative Margins》
2、使用 em :当用户改变字体大小时,宽度同时改变。
技巧:用 13 像素来平分宽度(保留小数到千分位),而 IE 浏览器用 13.333 。
/* 750 centered, and backward compatibility */
#doc {
width:57.69em;
*width:56.251em;
min-width:750px;
}
    57.69 = 750 / 13     56.251 = 750 / 13.333
注:《Setting Page Width with YUI Grids》 一文中提到:IE 下的 em 是宽度除以 13 ,再乘以 .9759 得到。同解于为什么现在的 YUI 源码中 IE 下 750px 的宽度是:56.301em(750 / 13 * 0.9759)。
此算法将在 YUI 的下个版本中换为上面的新算法(IE 浏览器用 13.333 )。
3、清除布局的浮动
针对非 IE 浏览器:
.yui-gf:after {
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}

而对于 IE 浏览器,使用了 zoom:1 来触发 haslayout。不过对于此 Nate Koechley 这样解释的:
Zoom is a non-valid attribute and so you’ll see warnings when you validate your CSS. I’m aware of that and think it is an acceptable tradeoff.
个人比较赞成他的想法:I think it is an acceptable tradeoff。