<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alibaba.com UED &#187; Web Developer</title>
	<atom:link href="http://www.aliued.com/category/web-developer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aliued.com</link>
	<description>Alibaba.com User experience design team</description>
	<lastBuildDate>Mon, 26 Jul 2010 01:24:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>阿里巴巴国际站UED博学堂</title>
		<link>http://www.aliued.com/2010/06/23/325/</link>
		<comments>http://www.aliued.com/2010/06/23/325/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 12:06:54 +0000</pubDate>
		<dc:creator>行骏</dc:creator>
				<category><![CDATA[Web Developer]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=325</guid>
		<description><![CDATA[
博学乃学识渊博，知道的多，了解的广。堂乃我们之集体。博学堂以提高我们整体的知识为目标开展活动。博学堂为前端开发者和网站设计者提供了一个交流分享的平台。一起分享代码的乐趣... ]]></description>
			<content:encoded><![CDATA[<p><a><img class="alignnone size-full wp-image-326" title="aliUED博学堂" src="http://www.aliued.com/wp-content/uploads/2010/06/2008317133917607_2.jpg" alt="aliUED博学堂" width="533" height="533" /></a></p>
<p>博学乃学识渊博，知道的多，了解的广。堂乃我们之集体。<strong>博学堂</strong>以提高我们整体的知识为目标开展活动。<strong>博学堂</strong>为前端开发者和网站设计者提供了一个交流分享的平台。一起分享代码的乐趣，总结项目的成长，展望新技术的发展。</p>
<p><strong>博学堂</strong>是国际站UED内部的分享平台。专注于知识分享、工作交流、成果推广等领域，致力于构建自由、开放、互助的分享环境。只要你敢喷，我们就给你提供舞台！ 自愿参与，广泛的话题，充足的时间，充分的自由！</p>
<p>简单列举了曾经的分享主题：<br />
<strong>1. </strong><strong>JIRA</strong><strong>系统应用</strong><strong>：</strong>Jira系统是优秀的项目管理与工作流跟踪软件，目前已经在UED全面部署应用。</p>
<p><strong>2. </strong><strong>JS</strong><strong>开发心得：</strong>主要分享在大图预览与智能联想开发过程中的编程思路、难点解决方案。内容涉及： 图片缩放及拖拽预览解决方案； 模块化编程的应用思路； 探讨如何保证复用性的同时，使程序具备一定的扩展性。</p>
<p><strong>3. </strong><strong>异步上传组件：</strong>异步上传组件的设计思路及其布署方案。<br />
<img class="size-full wp-image-327" title="异步上传组件" src="http://www.aliued.com/wp-content/uploads/2010/06/zsS8snPtKvB9w_iGBrqIE4g2yJ.jpg" alt="异步上传组件" width="500" /></p>
<p><strong>4. </strong><strong>大图预览及其组件设计，内容有：</strong>A 封装用prototype JS，甚至iframe都动态生成;B 只有放大超出区域才启用拖动，且拖动限定范围;C 拖动启用半透明预览/虚线框定位平滑过渡效果;D 放大缩小加入动画效果;E 长按平滑放大/缩小效果实现,增量增加比例;F 放大比例条</p>
<p><strong>5. </strong><strong>UED</strong><strong>在项目中的流程框架</strong></p>
<p><strong>6. </strong><strong>前端利器之 Fiddler</strong></p>
<p><strong>7. </strong><strong>Unicorn</strong><strong>基于High Performance Web Sites的最佳实践</strong></p>
<p><strong>8. </strong><strong>UED</strong><strong>图片格式，压缩处理</strong></p>
<p><strong>9. </strong><strong>阿里巴巴国际站前端核心框架结构讨论会</strong></p>
<p><strong>10. </strong><strong>WordPress</strong><strong>分享等</strong></p>
<p><strong>以上更多的只是简单的和不完全的列举，博学堂为阿里巴巴国际站UED积累了很多宝贵的资料和分享，接下来希望这样的交流能够有更多的人参与进来，并且可以分享到更多的人。</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2010/06/23/325/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>第4届D2前端技术论坛开始报名</title>
		<link>http://www.aliued.com/2009/12/05/322/</link>
		<comments>http://www.aliued.com/2009/12/05/322/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 09:26:58 +0000</pubDate>
		<dc:creator>Lucars</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[D2]]></category>
		<category><![CDATA[前端技术]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=322</guid>
		<description><![CDATA[2005年前端工程师的职位开始在中国出现，2007年第一届D2前端技术论坛在杭州举行，从此D2伴随着中国的前端一起成长，从此越来越多的互联网产品的背后有着职业前端工程师坚定的身影。
在D2... ]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding: 0px;">2005年前端工程师的职位开始在中国出现，2007年第一届D2前端技术论坛在杭州举行，从此D2伴随着中国的前端一起成长，从此越来越多的互联网产品的背后有着职业前端工程师坚定的身影。</p>
<p style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding: 0px;">在D2上我们曾交流过某项具体的前端技术，也曾探讨过团队协作的方式，那些美妙的话题都深入到我们频繁敲键盘的指尖。回首我们过去四年的坚持和梦想，现在是时候分享我们的积累和成果了。当架构、安全、性能等等在前端的领域扎根的时候，我们自己也在悄然发生质变，而推动这些变化的人和事正是D2想告诉你的。</p>
<ul style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 30px; list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px;">
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">本届主题</strong>：<a style="text-decoration: underline; color: #0064b1;" href="http://www.d2forum.org/d2/4/">蜕变·成长</a></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">论坛时间</strong>：2009年12月19日(星期六)</li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">论坛地点</strong>：杭州市滨江区网商路699号, 阿里巴巴B2B园区 <span style="font-size: 12px;">（<a style="text-decoration: underline; color: #456b95;" href="http://hangzhou.edushi.com/?oid=29529">地图</a>）</span></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">举办单位</strong>：<a style="text-decoration: underline; color: #456b95;" href="http://www.alibaba.com/">阿里巴巴</a></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">特别致谢</strong>：<a style="text-decoration: underline; color: #0064b1;" href="http://www.csdn.net/">CSDN</a>、<a style="text-decoration: underline; color: #456b95;" href="http://www.javaeye.com/">JavaEye</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.g-fox.cn/">谋智网络</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.baidu.com/">百度</a>、<a style="text-decoration: underline; color: #456b95;" href="http://www.douban.com/">豆瓣</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.hzbook.com/ps/">华章图书</a>、<a style="text-decoration: underline; color: #456b95;" href="http://www.koubei.com/">口碑网</a>、<br />
<a style="text-decoration: underline; color: #0064b1;" href="http://www.blueidea.com/">蓝色理想</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.qq.com/">腾讯网</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.turingbook.com/">图灵教育</a>、<a style="text-decoration: underline; color: #456b95;" href="http://www.taobao.com/">淘宝网</a>、<a style="text-decoration: underline; color: #0064b1;" href="http://www.alipay.com/">支付宝</a>。</li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">官网地址</strong>：<a style="text-decoration: underline; color: #0064b1;" href="http://www.d2forum.org/d2/4/">d2forum.org</a></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">推广视频</strong>：<a style="text-decoration: underline; color: #0064b1;" href="http://v.youku.com/v_show/id_XMTM2NDI0MDU2.html">http://v.youku.com/v_show/id_XMTM2NDI0MDU2.html</a></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">报名地址</strong>：<a style="text-decoration: underline; color: #0064b1;" href="http://www.d2forum.org/d2/4/sign_up.html">http://www.d2forum.org/d2/4/sign_up.html</a><span style="font-size: 12px;">（截止时间：2009.12.14 0:0:0）</span></li>
<li style="list-style-type: disc; padding: 0px; margin: 0px;"><strong style="font-weight: bold;">日程安排</strong>：<br />
<table id="table-d2" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-size: 12px; border-top-width: 1px; border-right-width: initial; border-bottom-width: initial; border-left-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-top-color: #cccccc; border-right-color: initial; border-bottom-color: initial; border-left-color: #cccccc;" border="0">
<thead>
<tr>
<th style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: #f3f3f3; background-position: initial initial; padding: 5px; margin: 0px;" width="100" scope="col">时间</th>
<th style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: #f3f3f3; background-position: initial initial; padding: 5px; margin: 0px;" width="270" scope="col">主题</th>
<th style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: #f3f3f3; background-position: initial initial; padding: 5px; margin: 0px;" scope="col">嘉宾</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">08:45 – 09:15</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">入场</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">09:15 – 10:15</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">《模板语言与大前端》</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"><a style="text-decoration: underline; color: #0064b1;" href="http://www.d2forum.org/2009/05/04/d2_fourth_guest_intro_jindawei/">金大为（百度）</a></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">10:30 – 11:30</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">《从YUI2到YUI3看前端的演变》</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"><a style="text-decoration: underline; color: #456b95;" href="http://www.d2forum.org/2009/04/30/d2_fourth_guest_intro_zhangkejun/">张克军（豆瓣）</a></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">11:30 – 13:00</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">午饭/休息/参观（阿里巴巴免费提供午餐）</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">13:00 – 14:00</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">《SilverlightQQ项目实践——Silverlight架构思考》</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"><a style="text-decoration: underline; color: #456b95;" href="http://www.d2forum.org/2009/04/16/d2_fourth_guest_intro_zyk/">甄焱鲲（腾讯）</a></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">14:15 – 15:15</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">《前端安全概览及防范》</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"><a style="text-decoration: underline; color: #0064b1;" href="http://www.d2forum.org/2009/05/09/d2_fourth_guest_intro_mingcheng/">吕峰军（淘宝）</a></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">15:30 – 16:30</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">《前端性能优化与自动化》</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"><a style="text-decoration: underline; color: #456b95;" href="http://www.d2forum.org/2009/12/03/d2_fourth_guest_intro_yanxuekun/">鄢学鵾（口碑）</a></td>
</tr>
<tr>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">16:30 – 18:00</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;">交流互动</td>
<td style="border-top-width: initial; border-right-width: 1px; border-bottom-width: 1px; border-left-width: initial; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: initial; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: initial; padding: 5px; margin: 0px;"></td>
</tr>
</tbody>
</table>
<p style="margin-top: 15px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; padding: 0px;">注意：以上安排可能会根据具体情况进行一些补充与修改。</p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2009/12/05/322/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>产品列表到底应该怎么做?</title>
		<link>http://www.aliued.com/2008/12/18/143/</link>
		<comments>http://www.aliued.com/2008/12/18/143/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 11:39:56 +0000</pubDate>
		<dc:creator>Lucars</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[清除浮动]]></category>
		<category><![CDATA[自适应高度]]></category>
		<category><![CDATA[语义]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=143</guid>
		<description><![CDATA[最近随着狂风计划的席卷，我也终于开始橱窗产品位列表展示的编码工作，这只是一个改进项目，因此有原代码可供参考。但是当我打开原代码模板的时候便愣住了，一个4 × n的矩阵为了执行d... ]]></description>
			<content:encoded><![CDATA[<p>最近随着狂风计划的席卷，我也终于开始橱窗产品位列表展示的编码工作，这只是一个改进项目，因此有原代码可供参考。但是当我打开原代码模板的时候便愣住了，一个4 × n的矩阵为了执行div + CSS的标准而放弃使用非常牛B的table布局，这本无可厚非，可是由于“某原因”（后文会陈述）却让本来很有优势的div布局失去了原有的优势，在我反复思考这个问题的时候怎样都觉得table布局能比现在的这个更加合适。那么这个非常霹雳的布局是怎么样的呢？请见下图：</p>
<div id="attachment_144" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/productlist01.png"><img class="size-full wp-image-144 " title="产品列表结构图" src="http://www.aliued.com/wp-content/uploads/2008/12/productlist01.png" alt="产品列表结构图（png太牛B了只有18K）" width="500" height="468" /></a><p class="wp-caption-text">产品列表结构图（png太牛B了只有18K）</p></div>
<p>我想绝大多数UEDer都不会使用如上布局来实现这个模块，首先想到的当然是使用DIV[productItem]做4 × n次的循环，然而这个布局却使用程序控制每四个DIV[productItem]给它们套一个DIV[productListRow]。可能很多人都已经发现了，这个布局有一个先天性的不足，也就是前文提到的“某原因”，那就是<strong>由于产品简介的长度不同导致每个DIV[productItem]的高度不同</strong>，因此需要在每行列表后面都清除浮动以让浏览器可以做出正确排列。那么解决办法也就出来了，很简单，有如下几个：</p>
<p>1、最方便、最有效、性价比最高的方法就是我们当然可以知道最长长度的产品名称和产品简介，因此我们分别取这两个值排满的最高高度来作为DIV[productItem]即可，但是这个方法却有致命的缺点导致所有UEDer都不会这么做得，那就是当出现有人不填写产品简介或者产品简介填写得非常少的时候便会出现大段的空白严重影响观看阅读。</p>
<p>2、那就这样把，咱把“产品简介”给拿掉吧，然后使用方法1便可以完美解决问题了。这个想法非常牛B，可是它太牛B了，我绝对不敢这样操刀直接把这么重要的内容给砍掉（也许有人觉得这些内容并不重要，但是这不是这篇文章所要讨论的东西）。我对曾经抱有次想法表示遗憾和羞愧。</p>
<p>3、<strong>为什么不使用table布局呢？</strong>天哪我觉得这简直就是最完美的办法了，table一出八马难追的。能够自适应高度的table在这个应用上拥有绝对的优势啊，如果前端开发工程师们可以放下一点架子在html上使用它原本应该使用的结构该是多么美好的事情，我直到在写这篇博客的时候依然觉得使用table解决问题又快又省力还很有快感哦~（其实原代码中的div布局就是抄袭了table的“思想理念”了）</p>
<p>但是作为一个在非常牛B的UED团队的还是菜鸟的我为了要做出非常牛B的事情也为了团队的面子，怎样也不能使用上面三种投机取巧的办法来敷衍这个现实的问题吧，因此就有了这篇博客最重要的内容。</p>
<p><strong><span style="text-decoration: underline;">第一次尝试：</span></strong></p>
<p>首先我们还是来考虑考虑到底使用什么标签来写这个列表吧，所谓back 2 base嘛。重新分析列表中最重要的元素有且仅有：标题、图片、简介。显然标题是最重要的，作为一个product的title存在，而图片和简介都是用来描述标题的内容，因此第一个想到的标签就是dl，这样便有了以下布局（抱歉还没有时间整一个代码输入）：</p>
<blockquote><p>&lt;dl&gt;<br />
&lt;dt&gt;[name]&lt;/dt&gt;<br />
&lt;dd&gt;&lt;div&gt;[photo]&lt;/div&gt;&lt;div&gt;[intro]&lt;/div&gt;&lt;/dd&gt;<br />
&lt;/dl&gt;</p></blockquote>
<p>对dt和dd都做float:left，dt做一个margin-top:100px来定位到图片和简介中间，dd做一个margin-left:-25%来定位到和dt相同的x坐标（由于无法输入代码就不贴css了）这样的html是我认为最贴切的，根据现在流行的html语义化定义这样的布局太合适不过了。当然css中还是存在非常多的困难，而前面所说的“某原因”也并没有得到解决，反而更甚了，因为把标题和简介流拆开后，标题过长便会和简介的文字叠加根本无法阅读！然而经过几秒钟的思考后认为这玩意儿的解决已经超出了我的范围了。当然，有人可能会说把标题和图片换一个不就可以了么？是的，没错，但是如果这样的话使用dl标签还有什么意义呢？可能有意义吧，就是标题和简介都是为了说明这张图片而存在的，但是真的可以这么想吗？还有待实验去证明，这里就不讨论了。</p>
<p><strong><span style="text-decoration: underline;">第二次尝试：</span></strong></p>
<p>如上所述，dl的存在就没意义了，那就算了吧，退而求其次使用ul（<strong>请在砸我鸡蛋前念着我还死了那么多脑细胞在这个上面的份上轻点儿吧</strong>），无序列表虽然不如定义列表来得语义那么强烈，但至少它还是和列表吧，至少不是一个division吧。ul的布局相比较就简单多了，看上去也只是把div标签换成了li而已，那么html结构如下：</p>
<blockquote><p>&lt;ul&gt;<br />
&lt;li&gt;&lt;div&gt;[photo]&lt;/div&gt;<br />
&lt;div&gt;[name]&lt;/div&gt;<br />
&lt;div&gt;[intro]&lt;/div&gt;<br />
&lt;/li&gt;<br />
&lt;/ul&gt;</p></blockquote>
<p>到这个时候终于要直面本文第四次提到的“某原因”了，如何解决li浮动后高度不同导致的矩阵错位问题？最先进入脑子的想法就是记得很久很久以前看到过一篇关于div自适应高度的文章，于是就在google翻找，当时没有收藏真是太失误了。在google搜索自适应高度那是相当多呀，但是有<a title="A List Apart: Articles: In Search of the Holy Grail" href="http://www.alistapart.com/articles/holygrail" target="_blank">一篇文章是不得不借鉴</a>的，但是这篇文章并不是适应于我们的案例，很显然它更适用于两栏或者三栏布局，而我们至少有四栏甚至五栏。自此还有什么办法可以让多列布局自适应高度呢？（请不要跟我提关于<a title="Equal Height Columns - revisited - In search of the One True Layout" href="http://www.positioniseverything.net/articles/onetruelayout/equalheight" target="_blank">巨大的padding与负margin这件事</a>）伪装的自适应对于需要货真价实产品的我们是没有用的……至此思维告一段落，我需要回到源头来，最开始的出发点在哪里？如果只是为了清除浮动的话？使用最简单的方法？</p>
<p>带着上面的问题，便渐渐有了解决方案，不可避免的，我可能需要借助后台工程师的力量了，我在每4个li之后的那个li上加上<a title="CSS clear 属性" href="http://www.w3school.com.cn/css/pr_class_clear.asp" target="_blank">clear:left属性</a>，以清除左边的浮动来防止它因为前面li的高度不够而导致的错位，从它之后的li就应该会乖乖地跟在它的后面了。这个想法很美好，但是很天真，可能我确实在FF等标准浏览器下面获得了预想中的效果（没有想到实现起来那么简单，正在开心中），突然发现又是那该死的IE！！！那个加了clear属性的li确实正常显示了，但是在它之后的那些继续原来它应该范的错误，没有起到清除整行浮动的作用。我懊恼了~通过漫长的研究至今已经找到了一个语义和样式都比较平衡的点却无法在IE中得以实现，怎么办？</p>
<p>第一个想法就是使用hack技术（虽然UEDer们都不推崇，但是为了维护之前的成果，老子发飙了），问题就是如何做hack。先看这样的例子，如果我每4个li后面都插一个&lt;li style=”clear:both;float:none;”&gt;&lt;/li&gt;的话，不管在IE下还是在FF下都可以完美地完成任务，但是这个方案有一个致命的缺陷，就是对原有html语义的破坏，凭什么好好的列表突然就多出一个空li来？那么能不能在不影响原来语义的情况下，在FF依然使用它应该使用的clear:left方式的情况下来针对IE进行hack呢？非常幸运的是IE给我们提供了条件注释工具<a title="CSS - Conditional comments" href="http://www.quirksmode.org/css/condcom.html" target="_blank">&lt;!–[if IE]&gt;&lt;![endif]–&gt;</a>（我想一旦开始使用这个东西之后一定会非常依赖它的），因此html结构就变成了这样：</p>
<blockquote><p>&lt;li&gt;[productItem]&lt;/li&gt;<br />
&lt;!–[if IE]&gt;&lt;li class=”clearForIE”&gt;&lt;/li&gt;&lt;![endif]–&gt;<br />
&lt;li class=”clearForFF”&gt;[productItem]&lt;/li&gt;</p></blockquote>
<p>希望这样能够看得懂。至此为了尽力表述完整语义的目的就达到了，因为所有的浏览器、搜索引擎和用户都会把那段IE的hack作为一个普通的注释来看待（这里也包括IE自己，这是一段条件注释，那还是注释），因此产品列表的li就没有被中途无故打断，更不会像最早的div版本每四个是一个division。到这里研究工作就算完成了（关于这个IE特有的hack的可能的严重后果木有给予考虑。。。），不过还有一些额外的思考。</p>
<p>其实使用division也不完全是不好，如果division这样做：</p>
<blockquote><p>&lt;div class=”top20″&gt;<br />
&lt;div class=”top15″&gt;<br />
&lt;div class=”top10″&gt;<br />
&lt;div class=”top5″&gt;<br />
DIV[productItem]{1-5}<br />
&lt;/div&gt;<br />
DIV[productItem]{6-10}<br />
&lt;/div&gt;<br />
DIV[productItem]{11-15}<br />
&lt;/div&gt;<br />
DIV[productItem]{16-20}<br />
&lt;/div&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2008/12/18/143/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>D2之上海行（第三届D2前端技术论坛）</title>
		<link>http://www.aliued.com/2008/12/14/136/</link>
		<comments>http://www.aliued.com/2008/12/14/136/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 13:31:14 +0000</pubDate>
		<dc:creator>Lucars</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[d2forum]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=136</guid>
		<description><![CDATA[D2结束已经两个礼拜了，现在才开始写这篇博客足以见得D2的影响之“深远”，当然希望它的影响力真的可以深远到在下次再看到D2的时候已经能够足够媲美高级行业峰会的姿态了。
作为业界的... ]]></description>
			<content:encoded><![CDATA[<p>D2结束已经两个礼拜了，现在才开始写这篇博客足以见得D2的影响之“深远”，当然希望它的影响力真的可以深远到在下次再看到D2的时候已经能够足够媲美高级行业峰会的姿态了。</p>
<p>作为业界的晚辈，我当然很期待能够参加这样的聚会，因此在收到<a title="PlanABC - 怿飞's Blog" href="http://www.planabc.net/" target="_blank">圆心</a>同学发来的邀请函时切实感受到的荣幸倍至直到现在依然还在自己小宇宙的某处荡漾着（好似我废话很多，这其实是想引证一下在周五晚上下班后坐上“幸福班车”油然而生的兴奋充斥了头皮）从不到一年前刚刚踩进前端这个行业到能够在第二天进入到国内前端技术行业领先的大型学习交流会简直有如做梦般不可思议，就好像看到精心培育的风信子终于开出了艳丽的花朵一样。</p>
<div id="attachment_137" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/img_3242.jpg"><img class="size-full wp-image-137" title="D2贴纸" src="http://www.aliued.com/wp-content/uploads/2008/12/img_3242.jpg" alt="D2贴纸" width="500" height="281" /></a><p class="wp-caption-text">D2贴纸</p></div>
<p>第二天清早我们一行9个人8点就起来打点行装前去会场锦江国际酒店，本以为已经算是比较早到的一批与会人员了，不料taobao和中文站的同学早已来到会场。会场早已布置好了两块大屏幕分别显示演讲者的演示稿和<a title="叽歪网" href="http://jiwai.de/" target="_blank">叽歪网</a>线上直播，据说这次D2的报名者达到了600人之多，大大超出了主办方的预料因此不得不临时更换主办场所，而与此同时也不得不委屈近50%的前端技术爱好者仅发了300人的邀请，为此特意开辟了叽歪网的D2forum来为没有能够到达现场的同行们同步传达会场的内容，这里要特别感谢主办方<a title="土豆网" href="http://www.tudou.com/" target="_blank">土豆网</a>的细心设置。</p>
<div id="attachment_138" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/img_3126.jpg"><img class="size-full wp-image-138" title="D2论坛Adobe分享" src="http://www.aliued.com/wp-content/uploads/2008/12/img_3126.jpg" alt="来自Adobe的7yue同学分享Flash10相关内容" width="500" height="281" /></a><p class="wp-caption-text">来自Adobe的7yue同学分享Flash10相关内容</p></div>
<p>这次D2论坛的主题是“前沿技术与前端协作”，在上午的两场讲演中，来自Adobe的7yue同学为我们带来了新鲜出炉的Flash10技术分享，Flash10诸多的新特性和十分牛X的方方面面都在早上1个小时的分享当中展示出来，其中的<a title="Adobe Labs - Pixel Bender" href="http://labs.adobe.com/technologies/pixelbender/" target="_blank">Pixel Bender</a>工具真是令与会同学们大开眼界，至少在他牛X的Apple Air上轻松地运行这些动态视频像素级渲染看起来是多么的美好，可以看得出7yue同学为此做了充分的准备，它作为演讲嘉宾为这次的D2带来了绚丽的开场。我们都能认识到作为新生的行业，前端技术是一个飞速发展的技术，掌握前沿技术的重要性毋须质疑。</p>
<div id="attachment_139" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/img_3161.jpg"><img class="size-full wp-image-139" title="D2论坛Microsoft分享" src="http://www.aliued.com/wp-content/uploads/2008/12/img_3161.jpg" alt="来自Microsoft的超群同学分享IE8与Silver Light相关内容" width="500" height="281" /></a><p class="wp-caption-text">来自Microsoft的超群同学分享IE8与Silver Light相关内容</p></div>
<p>同样属于前沿技术分享的来自微软的超群同学给大家带来的<a title="IEBlog" href="http://blogs.msdn.com/ie" target="_blank">IE8</a>与<a title="The Official Microsoft Silverlight Site" href="http://silverlight.net/" target="_blank">Silver Light</a>的新特性分享是一场非常有趣的分享，不管现在的IE产品有多么的令人诟病，但是看起来即将到来的IE8被寄予了大群博士、博士后开发团队非常大的期望，而超群也为我们展示了足以令人对IE有所改观的新特性和功能。而Silver Light在高清视频流媒体上的NB程度简直令我乍舌了，源生支持H.263和mpeg4编码的Silver Light的运行速度其实有点令人担忧，但是超群同学的演示似乎并没有那么困难，只是电脑硬件条件符合了要求是没有用的，祖国的网络硬件条件啥时候才能满足在线观看720P的高清视频呢？</p>
<div id="attachment_140" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/img_3157.jpg"><img class="size-full wp-image-140" title="D2论坛Alibaba分享" src="http://www.aliued.com/wp-content/uploads/2008/12/img_3157.jpg" alt="来自Alibaba的Justin同学分享" width="500" height="281" /></a><p class="wp-caption-text">来自Alibaba的Justin同学分享</p></div>
<p>另外的四场分享都针对着“前端协作”这个主题，开发协作其实一直是所有技术开发人员共同的问题，前端必然需要直面这个严肃的话题。来自土豆网、<a title="淘宝网" href="http://www.taobao.com/" target="_blank">淘宝网</a>、<a title="Alibaba.com" href="http://www.alibaba.com/" target="_blank">Alibaba</a>的同学分别分享了各自团队的协作经验。也许很多人觉得团队协作是主管们要考虑的事情，而自己只要做好技术的本职工作就好，因此当天在会场上听到了许多表示希望可以听到更多技术分享的话题，这个希望下一届的主办方可以多参考民众的需求吧，充分发挥UCD的理念。同时晚辈也觉得四位老大们分享的前段协作似乎稍微不够浅显了，也难怪会有异样的声音。</p>
<div id="attachment_141" class="wp-caption alignnone" style="width: 510px"><a href="http://www.aliued.com/wp-content/uploads/2008/12/img_3170.jpg"><img class="size-full wp-image-141" title="D2合影" src="http://www.aliued.com/wp-content/uploads/2008/12/img_3170.jpg" alt="D2合影（请注意某人右手的包）" width="500" height="281" /></a><p class="wp-caption-text">D2合影（请注意某人右手的包）</p></div>
<p>因为不可抗拒的原因，论坛比预计的时间提早了1个半小时结束，直接导致我们无敌男人小组的不知所措，车票已然定好，剩下的时间就只能在候车室打法了。终于能够把握这次机会坐上一趟和谐号了，可惜乌漆抹黑的晚上根本无法享受170KM/H的快感，只能在睡梦中消化白天的学识了。</p>
<p>最后，所有D2的资料都可以在<a href="http://www.d2forum.org/2008/12/04/look-back-upon-the-third-d2-forum/">http://www.d2forum.org/2008/12/04/look-back-upon-the-third-d2-forum/</a>这里找到。下一届的D2会回到杭州，期待能有更多的技术交流了。</p>
<p>PS：期待IE系列贴纸</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2008/12/14/136/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>良好的代码注释</title>
		<link>http://www.aliued.com/2008/06/06/75/</link>
		<comments>http://www.aliued.com/2008/06/06/75/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 14:24:57 +0000</pubDate>
		<dc:creator>5key</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=75</guid>
		<description><![CDATA[当你加入到一个项目，相关的CSS文件可能会看得你头昏眼花。时间一长，修改了哪些内容，增加了哪些内容，也都弄不清，维护成本相当的高。正好我们国际站正在进行代码的规范工作。下面... ]]></description>
			<content:encoded><![CDATA[<p>当你加入到一个项目，相关的CSS文件可能会看得你头昏眼花。时间一长，修改了哪些内容，增加了哪些内容，也都弄不清，维护成本相当的高。正好我们<a title="阿里巴巴" href="http://www.alibaba.com" target="_blank">国际站</a>正在进行代码的规范工作。下面的这段代码注释的思路值得借鉴。</p>
<p>通常写法:</p>
<blockquote><p>#sidebar ul li a {<br />
display: block;<br />
background-color: #ccc;<br />
border-bottom: 1px solid #999;<br />
margin: 3px 0 3px 0;<br />
padding: 3px;<br />
}</p></blockquote>
<p>注释的代码段：</p>
<blockquote><p>#sidebar ul li a {<br />
display: block;<br />
background-color: #ccc;<br />
border-bottom: 1px solid #999; /* ADDED Apr. 9, 2008 */<br />
margin: 3px 0 3px 0;<br />
padding: 3px; /* CHANGED Feb. 14, 2008 (Prev. 1px) */<br />
}</p></blockquote>
<p>上面的代码中，注释了增加代码的时间，修改代码的时间以及修改前的属性值。如果是多人协作，我建议还加上修改者的名称。当然，这样一直写下将带来过多的垃圾代码。需要定期的整理归档，保持文档的时效性。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2008/06/06/75/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>用JS开发页面动画效果时的一个设计思路</title>
		<link>http://www.aliued.com/2007/12/10/38/</link>
		<comments>http://www.aliued.com/2007/12/10/38/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 02:34:46 +0000</pubDate>
		<dc:creator>Salan</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[9]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=38</guid>
		<description><![CDATA[首先说明下范围

用Javascript来开发WEB页面的动画效果
该思路同时考虑页面效率、SEO，如果数据大，也可以缓解后端压力。
这个是程序设计思路
还谈不上思想，只是自己实践使用过的一个方法

... ]]></description>
			<content:encoded><![CDATA[<p>首先说明下范围</p>
<ol>
<li>用Javascript来开发WEB页面的动画效果</li>
<li>该思路同时考虑页面效率、SEO，如果数据大，也可以缓解后端压力。</li>
<li>这个是程序设计思路</li>
<li>还谈不上思想，只是自己实践使用过的一个方法</li>
</ol>
<p><span id="more-38"></span><br />
我们经常看到网页上有各种各样的动画，例如下图</p>
<p><img style="width: 552px; height: 136px;" src="http://www.aliued.com/wp-content/uploads/2007/12/demo20071210.jpg" alt="demo20071210.jpg" width="572" height="146" /><br />
有N条记录，需要在页面上滚动显示，并且需要循环。</p>
<p>我们先假设一下<strong>条件</strong></p>
<ol>
<li>这些记录都需要被搜索引擎收录</li>
<li>直接对页面元素做动画有困难（这里可能比较简单，但是困难的情况还是很多的）</li>
<li>信息需要循环显示</li>
<li>数据比较多，N条</li>
</ol>
<p>这个时候出现<strong>问题</strong></p>
<ol>
<li>数据必须是HTML标签，不能直接写入JS</li>
<li>直接对页面元素控制，并做动画有难度。由于要循环，得拆分子元素</li>
<li>数据比较多，控制子元素会出现效率问题</li>
</ol>
<p>第一个问题呢，我们这么做，让HTML载入，然后用JS来读取HTML信息作为数据控制。这个应该比较简单的。</p>
<p>第二个问题怎么搞呢，我们在读完数据之后，再搞出一个代理层来，比如叫A层。那么A层仅仅是提供显示，JS控制这个层来做动画。每次动画的时候呢把新的数据填进去，再做动画。</p>
<p>第三个问题迎刃而解，控制A层就OK了。</p>
<p><strong>Y方案：具体看看流程吧：（我把JS读取数据的步骤省略不说了，这个相信大家都知道怎么搞）</strong></p>
<p>第一步，元素的层次结构：</p>
<p> A层  z-index:2;&#8212;&#8212;&#8212;&#8212;   隐藏  //负责动画<br />
真层 z-index:1;&#8212;&#8212;&#8212;&#8212;  显示  //给爬虫看，且负责显示的当前信息</p>
<p>第二步动画：完成后返回第一步既可。</p>
<p>A层填入数据&#8211;》显示&#8211;》动画 <br />
动画结束之后，B层直接设置坐标，到标准位置<br />
A层隐藏。</p>
<p>上面这样做的理由是，填数据的过程，是会造成页面抖动的，所以我们把这个过程隐藏的来完成。</p>
<p><strong> 更升级的问题</strong>，如果真层直接设置坐标也比较困难，怎么办？那么就再搞个B层出来</p>
<p><strong>X方案：</strong> </p>
<p>A层  z-index:3;&#8212;&#8212;&#8212;&#8212;   隐藏 //负责动画<br />
 B层  z-index:2;&#8212;&#8212;&#8212;&#8212;   显示 //只显示当前信息<br />
真层 z-index:1;&#8212;&#8212;&#8212;&#8212;  隐藏 //仅仅给爬虫看，以及读取数据用，之后不再显示</p>
<p>动画的时候，A填入数据&#8211;》A显示&#8211;》A动画&#8211;》B填入数据&#8211;》A隐藏</p>
<p><strong>再升级下问题</strong>：如果数据实在太多，没法一次用HTML载入完成，怎么办？那么用AJAX来搞吧，具体做法和上面一样</p>
<p><strong>从具体到抽象：</strong><strong>设计的思路是数据和表现分离。<br />
</strong>给用户看的其实是一个JS创建出来的层，不断的更新数据，不断的隐藏显示来造成假象，然后做动画。</p>
<p><strong>注意的问题</strong>：如果每个item中，图片比较多，可能会浪费浏览器的渲染时间和增加HTTP请求。适合用Y方案。如果数据需要异步，且比较难控制坐标的时候，那么适合用X方案。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2007/12/10/38/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>分享一些css有关处理浏览器兼容问题上的小技巧</title>
		<link>http://www.aliued.com/2007/12/10/37/</link>
		<comments>http://www.aliued.com/2007/12/10/37/#comments</comments>
		<pubDate>Mon, 10 Dec 2007 01:46:42 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Web Developer]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=37</guid>
		<description><![CDATA[ 作者: jacky
css里关于浏览器的兼容问题一直困惑着我们初级的css用户（高手可直接绕过），这里想根据我前段时间拜读的李超的书籍《css网站布局实录》里学到的有关处理浏览器兼容的问题，... ]]></description>
			<content:encoded><![CDATA[<p> 作者: jacky</p>
<p>css里关于浏览器的兼容问题一直困惑着我们初级的css用户（高手可直接绕过），这里想根据我前段时间拜读的李超的书籍《css网站布局实录》里学到的有关处理浏览器兼容的问题，根据我前段时间在公司minisite项目里碰到的一些问题和解决方法分享给大家。浏览器兼容性的问题，我想一直是困绕我们设计师的棘手问题，css的难点就在这里。解决好这个问题，我想你的css水平一定会得到大步的提升。</p>
<p>自从W3C标准推出以后，现在新的一些浏览器多多少少在使用这套web的新标准，但在各自对新标准的执行上并不统一，这就给我们设计师带来很多的问题。目前世面上主流的浏览器还是IE和firefox,这两个浏览器几乎占领着整个浏览器的市场。而IE下面大部分人在用IE6和IE7两个版本的浏览器，而这两个版本对css的支持有非常多的差异之处，这种差异是最需要我们设计师注意的，因为它跟我们的日常设计息息相关。我在实际的制作过程当中遇到的问题有绝大部分是出现在IE6和IE7的css兼容性问题上。IE6，IE7在加上firefox2.0，如果能把这三个浏览器都搞定了，也就基本上满足95%以上的用户了。在下面我列举了一些我在项目里碰到的实际的问题和解决的方法，其中有很多是css高手GL的处理思路和解决方法，非常值得吸取和借鉴，因为这为我们解决今后遇到类似的问题提供解决问题的思路。建议先阅读《css网站布局实录》这本书，现在出了新版本《css网站布局实录2》，要仔细阅读哦，相信我，的确能让你收益非浅。下面列举一些事例，希望能给大家提供一些借鉴：<span id="more-37"></span></p>
<p><span style="color: #c0c0c0"><strong>A: IE6/IE7 div等块对象默认具有高度</strong></span><br />
下面图A是IE6里的一个div,  宽度是420px,没有设置高度, 其在IE6/IE7浏览器里,默认DIV具有了一个br的高度,图B是在firefox2.0下显示,div无高度。这样就给我们设计师在实际制作过程当中带来问题，因为有的时候我们要设置一个div高度为5px，用于放置一张背景图片，在IE6里就会有问题。IE6的显示保持在了最低高度一个br，如图c，在同样设置height:5px;情况下，上面是firefox显示下面是IE6。解决的方法是在div里设置一下line-height:0px;</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197123577_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197123577_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图A</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197123212_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197123212_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图B</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197123234_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197123234_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图C</p>
<p><span style="color: #c0c0c0"><strong>B: IE6下块对象默认的3PX现象</strong></span><br />
如图，上面是IE6.0里的显示，下面是IE7.0和firefox2.0,红色div设置为float:left;图片在宽度正好的情况下，在IE7和firefox下可以上去，而在IE6里面就被显示在了第二行。这就是IE6的著名的3px现象，当一个对象设置为左悬浮，这个 块对像跟它右边浮上来的对象默认具有3px的margin, 解决的方法是针对于IE6，在css里写一个css hack, 如在左边的div上加：margin-right:0px!important;margin-right:-3px;!important这个标记IE7和firefox是支持的，而我们伟大的IE6却视而不见，我们就可以根据这个特点，让左div针对IE6有一个-3px的右margin,而IE7和firefox为0。</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197124275_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197124275_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a></p>
<p>有兴趣的可以拷贝下面代码自己请手去试一下:(考虑在blog里显示的问题，下面代码人为增加了一些空格，请copy的时候自行删去)<br />
&lt; div style=&#8221;width:502px;height:80px;border:1px solid #000;&#8221;&gt;&lt; div style=&#8221;width:250px;background-color:#ff0000;height:60px;float:left;margin-right:0!important;margin-right:-3px;&#8221;&gt;&lt; /div&gt;img&lt; /div &gt;</p>
<p><span style="color: #c0c0c0"><strong>C: 图层float实现页面布局，遇到的浏览器问题</strong></span><br />
这是我在具体做项目时实际遇到的问题，解决这个问题的思路和方法来自GL的支持，我把它整理出来分享，希望能给你有所帮助。</p>
<p>看下面图1，现在一共有divA, divB, divC, divD, divE这么５个div,　目标是让divD和divE移上去，跟divA其行显示，达到图２的效果。我在当时实现的时候，在divA,divB,divC里分别加上style=&#8221;float:left;clear:both&#8221;,这样在IE6和IE7里实现了图2的效果，但在firefox里就出现了图3的显示，我在当时试过很多方法, 如在div4里写float:right;让div4有悬浮，想让它上去，这样只能跟divC并列显示。对css感兴趣的人可以先自己试试，其实方法很是简单，给div4和div5分别设置个左边距如margin-left:380px;就解决了。这个例子解决起来其实很简单，这里是提供一种解决css兼容问题上的一种思路。</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197125591_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197125591_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图1</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197125591_1.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197125591_1.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图2</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197125591_2.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197125591_2.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图3</p>
<p><span style="color: #c0c0c0"><strong>D: 如何让图片在div里左右居中，上下居中</strong></span><br />
如下图1， 我们要让图片在IE6，IE7和firefox下图片相对div左右居中，上下居中来显示如图2，这是众多设计师可能都要面对要解决的问题，因为这种方式我们经常要用到。这里把解决的方法分享给大家，要想让图片左右对齐，我们可以在div里写入&#8221;style:text-align:center;&#8221;,左右居中问题好解决，现在看一下，IE6,IE7和firefox里，图片都已经是左右居中了，技术的难点是如何让图片在三个浏览器垂直居中。大部分人可能会考虑使用vertical-align:middle来使图片居中，加上去看看没有出现效果，这里我们针对图片设置如下代码：style=&#8221;_margin-top: expression(( 300 &#8211; this.height ) / 2);发现在IE6下效果实现了，再看看IE7和firefox, 没有变化，这里我们针对IE7和firefox来设置，在div里写入line-height:300px;vertical-align:middle,发现IE7这时候也有效果了，这里的line-height:300px;是根据div的高度定的，如果div的高度为100px,则这里设置line-height:100px,这里我们设置为300px。那么，这时候IE解决了，看一下firefox图片还没垂直居中，再对div增加样式:display:table-cell,现在再看看firefox也好了。</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197126276_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197126276_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图1</p>
<p><a target="_blank" href="http://www.aliued.com/jacky/attachment/1197126364_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197126364_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图2</p>
<p>参考代码：<br />
&lt; div style=&#8221;width:300px;height:300px;text-align:center;vertical-align:middle;line-height:300px;border:1px solid #ccc;display:table-cell&#8221;&gt;<br />
&lt; img src=&#8221;aaaa.jpg&#8221; mce_src=&#8221;aaaa.jpg&#8221; style=&#8221;_margin-top: expression(( 300 &#8211; this.height ) / 2);&#8221; /&gt;<br />
&lt; /div &gt;</p>
<p><span style="color: #c0c0c0"><strong>E: IE捉迷藏现象</strong></span><br />
捉迷藏问题是IE非常典型的对css支持上的bug, 问题主要出现在IE6浏览器。当div嵌套结构稍微复杂时，就会出现捉迷藏情况。如下面例子：</p>
<p>起初我们写上比较简单的结构代码，如下：<br />
<a target="_blank" href="http://www.aliued.com/jacky/attachment/1197207745_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197207745_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a></p>
<p>上面代码非常简单，现在我们在里面尝试增加一些内容：<br />
<a target="_blank" href="http://www.aliued.com/jacky/attachment/1197207642_1.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197207642_1.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a></p>
<p>为了让bug显示，我们给上面的xhtml写上css样式，如下：<br />
<a target="_blank" href="http://www.aliued.com/jacky/attachment/1197207642_2.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197207642_2.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a></p>
<p>然后我们到IE7.0 firefox里先后去预览一下，显示一切正常，如下图1。<br />
<a target="_blank" href="http://www.aliued.com/jacky/attachment/1197205401_0.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197205401_0.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图1</p>
<p>我们再到IE6去打开它，发现在刚刚打开的时候，看到如下图2的情况，右侧的内容奇怪的消失了。全选页面内容，发现右侧内容是存在的，如果用鼠标移到链接上面，右侧的内容又跑了出来，这就是IE6著名的捉迷藏现象。不仅在目前事例中，在其他情况下也可能出现。造成这种现象的具体触发机制目前还不能合理的归类，至今为止，这种情况只在IE6下出现。<br />
<a target="_blank" href="http://www.aliued.com/jacky/attachment/1197205401_1.jpg"><img border="0" src="http://www.aliued.com/jacky/attachment/1197205401_1.jpg" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" class="insertimage" /></a><br />
图2</p>
<p>解决这个问题的方法，可以参考positioniseverything.net的网站专家给出的一些建议：<br />
a: 在代码的下面使用一个带有&lt; div style=&#8221;clear:both;&#8221;&gt;&lt; /div &gt;这样的div来清除悬浮<br />
b: 如果有可能，给layout对象设定width和height<br />
c: 可以尝试给layout和left对象使用position:relative<br />
d: 对layout使用line-height属性，强制浏览器对内容文字进行行距调整。</p>
<p>以上是提供解决浏览器问题的一些技巧，positioniseverything.net网站专家的建议，更重要的是要养成良好的编码习惯来预防捉迷藏情况的发生。</p>
<p>一些问题是浏览器自身的问题，遇到问题发生无法避免的情况下，那就要考虑使用一些css hack了，以下是针对IE6,IE7和firefox可以使用的一些css hack:<br />
a: 针对区别IE6 和IE7/firefox, 可以在要区别的代码后面跟上!important<br />
b:针对IE7/firefox 在css的前面加 [xmlns], 如下面的left属性，如果我想要只针对IE7/firefox起作用，写法如下：<br />
[xmlns] #left {<br />
 float:left;<br />
 border:4px solid #999;<br />
 padding:5px;<br />
 width:200px;<br />
 height:200px;<br />
}<br />
c: 只针对IE6起作用，可以在css前面加* html,如:<br />
* html #left {<br />
 clear:both;<br />
}</p>
<p>d: 只针对IE7起作用，在css里前面加*+html,如:<br />
*+html #left {<br />
 clear:both;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2007/12/10/37/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>被遮挡的绝对定位</title>
		<link>http://www.aliued.com/2007/11/26/30/</link>
		<comments>http://www.aliued.com/2007/11/26/30/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 02:27:54 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[Web Developer]]></category>

		<guid isPermaLink="false">http://www.aliued.com/?p=30</guid>
		<description><![CDATA[
&#60;div class=&#8221;A&#8221; style=&#8221;position:relative;&#8221;&#62;A (relative)
 &#60;div class=&#8221;logo&#8221; style=&#8221;position:absolute;z-index:99999;&#8220;&#62;&#60;/div&#62;
&#60;/div&#62;
&#60;div class=&#8221;B&#8221; style=&#8221... ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.aliued.com/blog/wp-content/uploads/2007/11/bug1.gif" alt="bug1.gif" /></p>
<p>&lt;div class=&#8221;A&#8221; style=&#8221;position:relative;&#8221;&gt;A (relative)<br />
 &lt;div class=&#8221;logo&#8221; style=&#8221;position:absolute;<strong>z-index:99999;</strong>&#8220;&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;B&#8221; style=&#8221;position:relative;&#8221;&gt;B (relative)&lt;/div&gt;</p>
<p>最近做minisite项目时，碰到了个奇怪的定位问题: 以上的A，B两个盒子是相对定位,<br />
标牌logo是A的子级，基于A做绝对定位<br />
问题描述：我们希望标牌logo显示在最上面，但在IE下logo标牌部分被B区域遮住,B在最上层显示，调整logo的z-index的数值调整无效，firefox下显示正常。</p>
<p>解决方案：先了解一下所涉及到的几个定位特性（非官方解释）：<br />
1. 相对定位元素默认的z-index的数值是0。<br />
2. 当两个相对定位同时出现时，代码靠后的z-index优先。<br />
3. 子级遵循父级设定的z-index；如果子级设定了绝对定位、z-index，可以冲破父级显示<br />
这个问题主要是ie对上面第3条错误解释导致的&#8212;在ie下子级的z-index不能冲破父级。网上解决这个bug的办法一般用hack使B为负值，来降低 B 在IE下级别，这种方法绕了一个大圈：z-index为负值时，产生了新的ie bug。</p>
<p>按照定位的特性，ie的这个bug是可以回避的，从表面上看 B 遮住了logo，实际上是 B 遮住了logo的父级 A ，只要将 A 的z-index设定大于B即可。</p>
<p><img src="http://www.aliued.com/blog/wp-content/uploads/2007/11/position.gif" alt="position.gif" /></p>
<p>&lt;div class=&#8221;A&#8221; style=&#8221;position:relative;<strong>z-index:1;</strong>&#8220;&gt;A (relative)<br />
 &lt;div class=&#8221;logo&#8221; style=&#8221;position:absolute;&#8221;&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;div class=&#8221;B&#8221; style=&#8221;position:relative;&#8221;&gt;B (relative)&lt;/div&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aliued.com/2007/11/26/30/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
