<?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>UIAIR Design</title>
	<atom:link href="http://www.uiair.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.uiair.com</link>
	<description>UIAIR Design Site</description>
	<lastBuildDate>Mon, 09 Apr 2012 08:22:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTML+CSS编写规范</title>
		<link>http://www.uiair.com/?p=155</link>
		<comments>http://www.uiair.com/?p=155#comments</comments>
		<pubDate>Mon, 09 Apr 2012 08:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Frontend]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=155</guid>
		<description><![CDATA[在任何一个项目或者系统开发之前都需要定制一个开发约定和规则，这样有利于项目的整体风格统一、代码维护和扩展。由于Web项目开发的分散性、独立性、整合的交互性等，所以定制一套完整的约定和规则显得尤为重要。 第一节 CSS样式文件的命名 建立样式表文件时，分类编写样式到下列样式表文件中，并统一放在【CSS】文件夹里： 主要 main.css 文字样式 font.css 表格 table.css 主题 themes.css 打印 print.css 补丁 mend.css 在项目初期，会把不同类别的样式放于不同的CSS文件，是为了CSS编写和调试的方便，在项目后期会为了网站性能上的考虑会整合不同的CSS文件到一个CSS文件，必要时可压缩。 第二节 CSS选择符的命名 所有选择符必须有小写英文字母或“_”下划线组成，样式名必须是表示该样式的大概含义（禁止出现如Div1、div2、Style1……），参考后面的“样式命名参考”。对CSS选择器的使用只允许派生选择器、类选择器和属性选择器，以及它们的组合使用，严禁使用ID选择器（ID是用于JavaScript的编写）。 如：li...]]></description>
			<content:encoded><![CDATA[<p>在任何一个项目或者系统开发之前都需要定制一个开发约定和规则，这样有利于项目的整体风格统一、代码维护和扩展。由于Web项目开发的分散性、独立性、整合的交互性等，所以定制一套完整的约定和规则显得尤为重要。</p>
<h4><a name="_Toc245619003"></a><a name="_Toc245618826"></a><a name="_Toc245197879"></a>第一节 CSS样式文件的命名</h4>
<p>建立样式表文件时，分类编写样式到下列样式表文件中，并统一放在【CSS】文件夹里：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="135"><a name="OLE_LINK2"></a><a name="OLE_LINK1"></a>主要</td>
<td valign="top" width="142">main.css</td>
<td valign="top" width="142">文字样式</td>
<td valign="top" width="142">font.css</td>
</tr>
<tr>
<td valign="top" width="135">表格</td>
<td valign="top" width="142">table.css</td>
<td valign="top" width="142">主题</td>
<td valign="top" width="142">themes.css</td>
</tr>
<tr>
<td valign="top" width="135">打印</td>
<td valign="top" width="142">print.css</td>
<td valign="top" width="142">补丁</td>
<td valign="top" width="142">mend.css</td>
</tr>
</tbody>
</table>
<p><a name="_Toc245197880"></a><a name="_Toc245619004"></a><a name="_Toc245618827"></a>在项目初期，会把不同类别的样式放于不同的CSS文件，是为了CSS编写和调试的方便，在项目后期会为了网站性能上的考虑会整合不同的CSS文件到一个CSS文件，必要时可压缩。</p>
<h4>第二节 CSS选择符的命名</h4>
<p>所有选择符必须有小写英文字母或“_”下划线组成，样式名必须是表示该样式的大概含义（禁止出现如Div1、div2、Style1……），参考后面的“样式命名参考”。对CSS选择器的使用只允许派生选择器、类选择器和属性选择器，以及它们的组合使用，严禁使用ID选择器（ID是用于JavaScript的编写）。</p>
<p>如：li span {…}td.fancy {…}input[type="text"]{…}</p>
<p>当定义的样式名比较复杂时用下划线把层次分开，比如：dcrm_logo{ …} dcrm_logo_ico{…}</p>
<h4><a name="_Toc245619005"></a><a name="_Toc245618828"></a><a name="_Toc245197881"></a>第三节 图片的命名与书写</h4>
<p>图片的命名原则小写英文字母名称放在头尾两部分，用“_”下划线隔开，头部表示此图片的大类性质例如广告、标志、菜单、按钮等等；尾部表示图片的概念。设计人员在PS中保存图片时，请使用“文件”à“存储为Web和设备所用的格式”。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="135">广告</td>
<td valign="top" width="142">banner</td>
<td valign="top" width="142">标志</td>
<td valign="top" width="142">logo</td>
</tr>
<tr>
<td valign="top" width="135">链接的小图片</td>
<td valign="top" width="142">button</td>
<td valign="top" width="142">装饰图</td>
<td valign="top" width="142">pic</td>
</tr>
<tr>
<td valign="top" width="135">标题的图片</td>
<td valign="top" width="142">title</td>
<td valign="top" width="142"></td>
<td valign="top" width="142"></td>
</tr>
<tr>
<td valign="top" width="561">banner_sohu.png 、banner_sina.png、 menu_about_us.png、menu_job.png、 title_news.gif、 logo_police.gif、 logo_national.gif 、pic_people.jpg</td>
</tr>
</tbody>
</table>
<h4><a name="_Toc245197882"></a><a name="_Toc245619006"></a><a name="_Toc245618829"></a>第四节 CSS注释书写规范</h4>
<h5>4.1 提示和标签信息注释</h5>
<p>这是注释最常用的途径，可以为自己或其他开发人员留下提示信息可以避免后期引起的不必要的困惑和麻烦。这种应用简洁性最为重要。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">.search{</p>
<p>border:1px solid #fff; /*Border Color*/ }</td>
</tr>
</tbody>
</table>
<p>注意：注释内容和前面样式语句间有3个空格，后面1个空格</p>
<h5>4.2 修改样式注释（时间和相关人员）</h5>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">/*__Styles Updated: Thu 4.8.08 @ 5:15 p.m. Author: hour</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</td>
</tr>
</tbody>
</table>
<h5>4.3 文档结构</h5>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">/*__Header</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>.search{</p>
<p>border:1px solid #fff; /*Border Color*/</p>
<p>color:#333; /*Color*/}</p>
<p>/*__Menu</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>.menul_ul{</p>
<p>border:1px solid #fff; /*Border Color*/}</td>
</tr>
</tbody>
</table>
<p>注意：相对独立的2段内容之间空1行。</p>
<h4><a name="_Toc245619007"></a><a name="_Toc245618830"></a><a name="_Toc245197883"></a>第五节 CSS布局编码标准和建议</h4>
<h5>5.1 建立样式表索引</h5>
<p>样式表头部索引定义可以帮助你和其它人弄清楚该样式表文件的相关信息，它一般是一段格式化的CSS注释文本写在 main.css中。给出该CSS文件作者的相关信息；定义站点的布局，记录文件版本号（利于多作者协作及将来更新）</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">/*&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>*Filename: main.css</p>
<p>*Description: Global CSS</p>
<p>*Version: 1.0.0(2009-12-28)YYYY-MM-DD</p>
<p>*Website: http://www.testsoft.com</p>
<p>==STRUCTURE:=================================== == ==== =====</p>
<p>*Page width: 980px</p>
<p>*Number of columns: 2</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</td>
</tr>
</tbody>
</table>
<h5>5.2 命名锚点 的使用</h5>
<p>命名锚点是用来规划整个CSS文件结构的（就好像书签一样），从而使整个CSS文件获得良好的组织。命名锚点一般也是书写在样式表头部的索引注释中。CSS本身没有内部的锚点系统，所以我一般采用下面的小技巧来完成。在头部索引拷贝你想找到的锚点，并在整个文档中查找，从而获取该CSS节。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">*==STRUCTURE:===============================================</p>
<p>$__header Header Definitions</p>
<p>$__menu Global Site</p>
<p>$__content Everything within the content</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>/*__header</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;*/</p>
<p>{&#8230;Header CSS Definitions&#8230;}</p>
<p>/*__menu</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-*/</p>
<p>{&#8230;Header CSS Definitions&#8230;}</td>
</tr>
</tbody>
</table>
<h5>5.3 建立良好的CSS编码顺序</h5>
<p>最后定义的 CSS 样式将会覆盖在其之前定义的所有已经存在、或与之冲突的样式，比如下面这个例子：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="558">p { color: red; background: yellow;}</p>
<p>p { color: green;}</td>
</tr>
</tbody>
</table>
<p>以上的段落最终将呈现绿色的字体，并带有黄色的背景，这是因为最后定义的 color:green 将之前定义的 red 覆盖掉了，至于黄色背景为何没有消失，那是因为第二个 p 的定义中并没有与之冲突的定义，因此它还是有效的。</p>
<h5>5.4 合适的缩写</h5>
<p>在CSS中经常会利用缩写把多个相同类型的属性定义指定为一个。CSS缩写会使CSS文档更加干净、简洁；缩写语法参考相关章节。</p>
<h5>5.5 CSS图像拼合(即CSS Sprites技术)</h5>
<p>CSS Sprites技术：将用到的所有小图片（图标）合并为一张图片，使用css背景属性，来控制图片的显示位置和方式。CSS Sprites技术的应用可以大大减少HTTP请求的次数，减轻服务器压力，同时缩短了悬停加载图片所需要的时间延迟，使效果更流畅，不会停顿。</p>
<h5>5.6 CSS组合和嵌套</h5>
<p><strong>CSS</strong><strong>组合</strong></p>
<p>你不必重复有相同属性的多个选择符，你只要用英文逗号（,）隔开选择符就可以了。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">h2 { color: red; }</p>
<p>.w3cbbs { color: red; }</p>
<p>.w3cbbs_52css { color: red; }</p>
<p>则你可以这样写h2,.w3cbbs,.w3cbbs_52css { color: red; }</td>
</tr>
</tbody>
</table>
<p><strong>CSS</strong><strong>嵌套</strong></p>
<p>CSS结构好的话，没有必要使用过多的类或者标识选择符。这是因为你可以指定在选择符内的选择符。</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">.top { background-color: #ccc; padding: 1em;}</p>
<p>.top h1 { color: #ff0; }</p>
<p>.top p { color: red; font-weight: bold; }</td>
</tr>
</tbody>
</table>
<h4><a name="_Toc245619008"></a><a name="_Toc245618831"></a><a name="_Toc245197884"></a>第六节 常用CSS选择符命名参考</h4>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="135">导航</td>
<td valign="top" width="142">nav</td>
<td valign="top" width="142">页头</td>
<td valign="top" width="142">header</td>
</tr>
<tr>
<td valign="top" width="135">主导航</td>
<td valign="top" width="142">mainnav</td>
<td valign="top" width="142">页面主体</td>
<td valign="top" width="142">main</td>
</tr>
<tr>
<td valign="top" width="135">顶导航</td>
<td valign="top" width="142">topnav</td>
<td valign="top" width="142">内容</td>
<td valign="top" width="142">content</td>
</tr>
<tr>
<td valign="top" width="135">子导航</td>
<td valign="top" width="142">subnav</td>
<td valign="top" width="142">页脚</td>
<td valign="top" width="142">footer</td>
</tr>
<tr>
<td valign="top" width="135">菜单</td>
<td valign="top" width="142">menu</td>
<td valign="top" width="142">版权</td>
<td valign="top" width="142">copyright</td>
</tr>
<tr>
<td valign="top" width="135">子菜单</td>
<td valign="top" width="142">submenu</td>
<td valign="top" width="142">登陆</td>
<td valign="top" width="142">login</td>
</tr>
<tr>
<td valign="top" width="135">标志</td>
<td valign="top" width="142">logo</td>
<td valign="top" width="142">侧栏</td>
<td valign="top" width="142">sidebar</td>
</tr>
<tr>
<td valign="top" width="135">广告</td>
<td valign="top" width="142">banner</td>
<td valign="top" width="142">搜索</td>
<td valign="top" width="142">search</td>
</tr>
<tr>
<td valign="top" width="135">滚动</td>
<td valign="top" width="142">scroll</td>
<td valign="top" width="142">标签页</td>
<td valign="top" width="142">tab</td>
</tr>
<tr>
<td valign="top" width="135">小技巧</td>
<td valign="top" width="142">tips</td>
<td valign="top" width="142">合作伙伴</td>
<td valign="top" width="142">partner</td>
</tr>
<tr>
<td valign="top" width="135">加入</td>
<td valign="top" width="142">joinus</td>
<td valign="top" width="142">标题</td>
<td valign="top" width="142">title</td>
</tr>
<tr>
<td valign="top" width="135">注册</td>
<td valign="top" width="142">regsiter</td>
<td valign="top" width="142">指南</td>
<td valign="top" width="142">g<a href="http://liumiao.me/html/list_567.html">UI</a>ld</td>
</tr>
<tr>
<td valign="top" width="135">新闻</td>
<td valign="top" width="142">news</td>
<td valign="top" width="142">下载</td>
<td valign="top" width="142">download</td>
</tr>
<tr>
<td valign="top" width="135">按钮</td>
<td valign="top" width="142">button</td>
<td valign="top" width="142">状态</td>
<td valign="top" width="142">status</td>
</tr>
<tr>
<td valign="top" width="135">服务</td>
<td valign="top" width="142">service</td>
<td valign="top" width="142">投票</td>
<td valign="top" width="142">vote</td>
</tr>
<tr>
<td valign="top" width="135">注释</td>
<td valign="top" width="142">note</td>
<td valign="top" width="142">友情链接</td>
<td valign="top" width="142">friendlink</td>
</tr>
<tr>
<td valign="top" width="135">提示信息</td>
<td valign="top" width="142">msg</td>
<td valign="top" width="142"></td>
<td valign="top" width="142"></td>
</tr>
</tbody>
</table>
<p>注意：命名方式使用“类别_功能”的方式（.bar_news{} .bar_product{}）。</p>
<h4>第七节 DIV+CSS页面的布局</h4>
<p>Table布局由于代码冗余已经过时，所以HTML页面普遍采用代码简洁Div+CSS的布局，HTML页面大体可分为top、main和bottom，在main中又可以为left和right，这些CSS的名必须是有意义的名字。如下面代码：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">&lt;body&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;/body&gt;</td>
</tr>
</tbody>
</table>
<p>目前table主要是用来展现数据表，反正在布局中尽量少用table。</p>
<h4>第八节 HTML代码书写规范</h4>
<p>页面的HTML代码书写必须符合XHTML规范，XHTML 可以被所有的支持 XML 的设备读取，同时在其余的浏览器升级至支持 XML 之前，XHTML 使我们有能力编写出拥有良好结构的文档，这些文档可以很好地工作于所有的浏览器，并且可以向后兼容。</p>
<p>XHTML与HTML的不同：</p>
<p>1. XHTML 元素必须被正确地嵌套。</p>
<p>2. XHTML 元素必须被关闭。</p>
<p>3. 标签名必须用小写字母。</p>
<p>4. XHTML 文档必须拥有根元素。</p>
<p>对于第1点：最有可能发生错误是在与&lt;table&gt;标签的结合，&lt;table&gt;的直接子元素只能为：&lt;thead&gt;、&lt;tbody&gt;、&lt;tfoot&gt;和&lt;tr&gt;，而 &lt;thead&gt;、&lt;tbody&gt;和&lt;tfoot&gt;的直接子元素只能为：&lt;tr&gt;，而&lt;tr&gt;的直接子元素只能为&lt;td&gt;和&lt;th&gt;，在&lt;td&gt;和&lt;th&gt;才可以放其它标签。此外相类似的标签有：&lt;dl&gt;、&lt;ul&gt;、&lt;ol&gt;、&lt;select&gt;…。</p>
<p>某些标签不推荐使用，如：&lt;b&gt;&lt;strong&gt;&lt;i&gt;&lt;em&gt; &lt;strong&gt; &lt;dfn&gt; &lt;code&gt; &lt;samp&gt; &lt;kbd&gt;&lt;var&gt; &lt;cite&gt;……，因为这些标签有些是可以用CSS去统一控制，还有一些是不常使用的；某些标签是有特殊意义的，如：&lt;h1&gt;…&lt;h6&gt;，这些标签是专门用于内容标题的，本人也希望只允许使用&lt;h1&gt;…&lt;h6&gt;来表示内容标题。</p>
<p>在编写HTML代码时请注意缩进，在VS中按Ctrl+E+D可格式化文本。</p>
<h4>第九节 网站基础CSS的定义</h4>
<p>网站CSS必须得有个统一的架构，复用CSS，尽量减少重复CSS的定义。基础CSS就是那些常用的CSS定义，如：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">.clear</p>
<p>{</p>
<p>clear: both;</p>
<p>}</p>
<p>.bold</p>
<p>{</p>
<p>font-weight: bold;</p>
<p>}</p>
<p>.left</p>
<p>{</p>
<p>text-align: left;</p>
<p>}</p>
<p>.error</p>
<p>{</p>
<p>color: Red;</p>
<p>}</p>
<p>.succeed</p>
<p>{</p>
<p>color: Green;</p>
<p>}</p>
<p>.center</p>
<p>{</p>
<p>text-align: center;</p>
<p>}</p>
<p>.fleft</p>
<p>{</p>
<p>float:left;</p>
<p>}</p>
<p>.fright</p>
<p>{</p>
<p>float:right;</p>
<p>}</p>
<p>.left15</p>
<p>{</p>
<p>margin-left: 15px;</p>
<p>}</p>
<p>.radius</p>
<p>{</p>
<p>border-radius: 5px;</p>
<p>}</td>
</tr>
</tbody>
</table>
<p>CSS元素选择器可以对同一标签进行统一的样式定义，有些标签应该使用元素CSS定义，如：</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="561">body</p>
<p>{</p>
<p>font-size: 12px;</p>
<p>font-family: Arial;</p>
<p>margin: 0;</p>
<p>padding: 0;</p>
<p>color: #403f3f;</p>
<p>background:url(&#8216;../images/page_top.png&#8217;) repeat-x top #d1d2d2;</p>
<p>}</p>
<p>a, a:link</p>
<p>{</p>
<p>color: #2a5685;</p>
<p>text-decoration: none;</p>
<p>line-height: normal;</p>
<p>}</p>
<p>a:hover</p>
<p>{</p>
<p>color: #E0303A;</p>
<p>text-decoration: none;</p>
<p>cursor: pointer;</p>
<p>}</p>
<p>ul</p>
<p>{</p>
<p>margin: 0px;</p>
<p>padding: 0px;</p>
<p>}</p>
<p>hr</p>
<p>{</p>
<p>height: 1px;</p>
<p>border: none;</p>
<p>border-bottom: #dcdddd 1px solid;</p>
<p>}</p>
<p>h1, h2</p>
<p>{</p>
<p>font-size: 1.5em;</p>
<p>color: #000;</p>
<p>}</p>
<p>h3</p>
<p>{</p>
<p>font-size: 1.2em;</p>
<p>}</p>
<p>h4</p>
<p>{</p>
<p>font-size: 1.1em;</p>
<p>}</td>
</tr>
</tbody>
</table>
<h4>第十节 CSS调试心得</h4>
<p>目前的浏览器基本上都有客户端调试工具，所以当对页面进行设计或调试时，请尽量使用此类工具，而不是改源文件，然后再刷新页面，使用客户端工具可及时增、删、改HTML元素所对应的CSS，还可以得到HTML元素所在布局的具体数值，如：</p>
<p><a href="http://images.cnblogs.com/cnblogs_com/Wenwang/201109/201109071523315752.png"><img title="clip_image001" src="http://images.cnblogs.com/cnblogs_com/Wenwang/201109/201109071523327313.png" alt="clip_image001" width="244" height="160" border="0" /></a> <a href="http://images.cnblogs.com/cnblogs_com/Wenwang/201109/201109071523344131.png"><img title="clip_image002" src="http://images.cnblogs.com/cnblogs_com/Wenwang/201109/201109071523369902.png" alt="clip_image002" width="244" height="178" border="0" /></a></p>
<p>在项目后期进行CSS调试时应，着重于页面展现给浏览器后形成的HTML+CSS代码，而不是关注于源文件，因为页面上很多元素是源文件里没有的，是动态生成的，对于那些动态生成的HTML元素，看看作用在它上面的CSS是哪些，再去修改其CSS或添加新的CSS。</p>
<p>对于CSS3，如果CSS3能达到更好的视觉效果，那就使用，不用去管那些不支持CSS3的浏览器，毕竟CSS3是一发展趋势，对于静态页面的设计人员也应该熟悉CSS3的那些效果（比如圆角、文字阴影……），来代替之前需要用图片来实现的效果。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=155</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>外层DIV自适应高度</title>
		<link>http://www.uiair.com/?p=152</link>
		<comments>http://www.uiair.com/?p=152#comments</comments>
		<pubDate>Fri, 06 Apr 2012 02:46:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Frontend]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=152</guid>
		<description><![CDATA[不设置最外层DIV的高度,但设置最外层DIV overflow为hidden,这样这层DIV的高度可以随着内部DIV的最大高度来调整;]]></description>
			<content:encoded><![CDATA[<p>不设置最外层DIV的高度,但设置最外层DIV overflow为hidden,这样这层DIV的高度可以随着内部DIV的最大高度来调整;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=152</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Super Awesome Buttons with CSS3 and RGBA</title>
		<link>http://www.uiair.com/?p=150</link>
		<comments>http://www.uiair.com/?p=150#comments</comments>
		<pubDate>Thu, 05 Apr 2012 10:52:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Frontend]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=150</guid>
		<description><![CDATA[We love CSS at ZURB. We love it so much that we&#8217;re using the new, yet-to-be released version (CSS3) in some...]]></description>
			<content:encoded><![CDATA[<p><strong>We love CSS at ZURB.</strong> We love it so much that we&#8217;re using the new, yet-to-be released version (CSS3) in some of our projects. In the works for nearly 10 years now, CSS3 is finally starting to see the light at the end of the tunnel as new browsers like Firefox and Safari continue to push its implementation.</p>
<p>One of our favorite things about CSS3 is the addition of RGBA, a color mode that adds alpha-blending to your favorite CSS properties. We&#8217;ve kicked the tires on it a bit with our own projects and have found that it helps streamline our CSS and makes scaling things like buttons very easy. To show you how, <strong>we&#8217;ve cooked up an example with some super awesome, scalable buttons.</strong></p>
<h4>The Button</h4>
<p>Here&#8217;s what we&#8217;re looking at:</p>
<div><img src="http://www.zurb.com/blog_uploads/0000/0394/super-awesome-buttons.png" alt="" /><cite>Our original button we&#8217;ll use to show how RGBA colors rock your world. See how the hex drop shadow works on white, but not dark? We&#8217;ll fix that.</cite></div>
<p>It&#8217;s a simple button made possible by a transparent PNG overlay (for the gradient), border, border-radius, box-shadow, and text-shadow. Here&#8217;s the CSS that we&#8217;ve got so far to make this super awesome button:</p>
<ol>
<li>.awesome{</li>
<li>background: #222 url(/images/alert-overlay.png) repeat-x;</li>
<li>display: inline-block;</li>
<li>padding: 5px 10px 6px;</li>
<li>color: #fff;</li>
<li>text-decoration: none;</li>
<li>font-weight: bold;</li>
<li>line-height: 1;</li>
<li>-moz-border-radius: 5px;</li>
<li>-webkit-border-radius: 5px;</li>
<li>-moz-box-shadow: 0 1px 3px #999;</li>
<li>-webkit-box-shadow: 0 1px 3px #999;</li>
<li>text-shadow: 0 -1px 1px #222;</li>
<li>border-bottom: 1px solid #222;</li>
<li>position: relative;</li>
<li>cursor: pointer;</li>
<li>}</li>
</ol>
<p>Not too shabby considering it&#8217;s nearly all done with CSS. We could use CSS3 to do the gradient as well, but currently only Safari supports that. For a little backward compatibility, we&#8217;ll keep it as a transparent PNG. Besides, the transparent PNG is easier to work with than setting the gradient in CSS since Safari only does CSS gradients at this point.</p>
<h4>Making it Scale with RGBA</h4>
<p>Sweet, so we&#8217;ve got our button styled up and looking great, but since we&#8217;re using “static” colors (Hex value), this button doesn&#8217;t scale very well. What if we need it to be shown on dark <em>and</em> white backgrounds? What about other colors? <strong>Here&#8217;s where RGBA comes in.</strong></p>
<div><img src="http://www.zurb.com/blog_uploads/0000/0400/super-awesome-buttons-fixed.png" alt="" /><cite><strong>Small Details.</strong> Notice the shadow on the button on the dark background? We fixed the buttons&#8217; shadow blending by using the RGBA colors.</cite></div>
<p>With a little RGBA love, we&#8217;ll scale this single button to add five more colors, two more sizes, and make it work on any background color. Check this out—all we have to do is modify three lines of CSS.</p>
<ol>
<li>.awesome {</li>
<li>&#8230;</li>
<li>-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);</li>
<li>-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);</li>
<li>text-shadow: 0 -1px 1px rgba(0,0,0,0.25);</li>
<li>border-bottom: 1px solid rgba(0,0,0,0.25);</li>
<li>&#8230;</li>
<li>}</li>
</ol>
<p>There, now we have our super awesome button with some alpha blending added in. Still looks the same right? That&#8217;s because we have a 25% black border, 50% box-shadow, and 25% text-shadow in place of regular hex values. This gives us what we need to make our original button scale to various backgrounds, colors, and sizes. With the RGBA values, <strong>we have layers of color instead of separate colors,</strong> much like what you get when doing transparent drop shadows in Photoshop.</p>
<h4>Adding the Colors and Sizes</h4>
<p>Now that we&#8217;ve got our default button to where we need it, let&#8217;s add some colors and sizes. Here&#8217;s the CSS to do it:</p>
<ol>
<li>/* Sizes &#8212;&#8212;&#8212;- */</li>
<li>.small.awesome {</li>
<li>font-size: 11px;</li>
<li>}</li>
<li>.medium.awesome {</li>
<li>font-size: 13px;</li>
<li>}</li>
<li>.large.awesome {</li>
<li>font-size: 14px;</li>
<li>padding: 8px 14px 9px;</li>
<li>}</li>
<li></li>
<li>/* Colors &#8212;&#8212;&#8212;- */</li>
<li>.blue.awesome {</li>
<li>background-color: #2daebf;</li>
<li>}</li>
<li>.red.awesome {</li>
<li>background-color: #e33100;</li>
<li>}</li>
<li>.magenta.awesome {</li>
<li>background-color: #a9014b;</li>
<li>}</li>
<li>.orange.awesome {</li>
<li>background-color: #ff5c00;</li>
<li>}</li>
<li>.yellow.awesome {</li>
<li>background-color: #ffb515;</li>
<li>}</li>
</ol>
<h4>Done Deal</h4>
<p>And now we have six buttons, each with three different sizes. You can <a href="http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html" target="_blank">see the final coded example here</a> to take a closer look at the code.</p>
<div><a href="http://www.zurb.com/blog_uploads/0000/0617/buttons-03.html" target="_blank"><img src="http://www.zurb.com/blog_uploads/0000/0397/super-awesome-buttons-all.png" alt="" /></a><cite>And there we have it: scalable buttons with minimal CSS that work everywhere.</cite></div>
<p>Although this example may be overkill—who really needs this many button colors?—the point is that RGBA is actually much more powerful than typical Hex values. Consider this: if we were using hex values, we&#8217;d have three times the CSS per color—one color for background, one for border, and one for text-shadow.</p>
<p>With a little CSS3 magic, <strong>we&#8217;ve created a scalable set of buttons with nearly half the CSS</strong> it would have taken with hex colors. Give it a go in your next project and see how it can help add that extra polish you want without huge impact on your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=150</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>没有期望就不会有失望，剩下的就全是惊喜。</title>
		<link>http://www.uiair.com/?p=147</link>
		<comments>http://www.uiair.com/?p=147#comments</comments>
		<pubDate>Wed, 29 Feb 2012 12:03:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=147</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=147</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>一切重头开始！</title>
		<link>http://www.uiair.com/?p=144</link>
		<comments>http://www.uiair.com/?p=144#comments</comments>
		<pubDate>Tue, 31 Jan 2012 15:43:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=144</guid>
		<description><![CDATA[今年的遭遇前所未有，自问自省未来就在前方，加油吧。]]></description>
			<content:encoded><![CDATA[<p>今年的遭遇前所未有，自问自省未来就在前方，加油吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=144</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>“青春”字体设计练习</title>
		<link>http://www.uiair.com/?p=139</link>
		<comments>http://www.uiair.com/?p=139#comments</comments>
		<pubDate>Sat, 31 Dec 2011 14:08:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Vision]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=139</guid>
		<description><![CDATA[“青春”字体设计练习]]></description>
			<content:encoded><![CDATA[<p>“青春”字体设计练习</p>
<p><a href="http://www.uiair.com/wp-content/uploads/2011/12/qingchun.jpg"><img class="aligncenter size-full wp-image-140" title="qingchun" src="http://www.uiair.com/wp-content/uploads/2011/12/qingchun.jpg" alt="" width="440" height="304" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=139</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>忙碌的2011</title>
		<link>http://www.uiair.com/?p=132</link>
		<comments>http://www.uiair.com/?p=132#comments</comments>
		<pubDate>Mon, 14 Nov 2011 08:09:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=132</guid>
		<description><![CDATA[这几个月很充实，只有合理支配时间劳逸结合，进步是看到的。]]></description>
			<content:encoded><![CDATA[<p>这几个月很充实，只有合理支配时间劳逸结合，进步是看到的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=132</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android中各种图标尺寸以及多分辨率支持方法</title>
		<link>http://www.uiair.com/?p=129</link>
		<comments>http://www.uiair.com/?p=129#comments</comments>
		<pubDate>Thu, 13 Oct 2011 07:54:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Product]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=129</guid>
		<description><![CDATA[1. Android中图标尺寸： AndroidManifest.xml中指定图标，名字不一定非叫icon &#60;application android:icon=”@drawable/icon” android:label=”@string/app_name”&#62; 2.0以后有三种尺寸，分别为36*36/48*48/72*72 你会看到drawable-hdpi/drawable-ldpi/drawable-mdpi不同的目录用来存储不同尺寸的图标，在AndroidManifest.xml中只需要写@drawable/icon就可以，它会根据屏幕分辨率去找不同目录下的图标 hdpi里面主要放高分辨率的图片,如WVGA (480&#215;800),FWVGA (480&#215;854) mdpi里面主要放中等分辨率的图片,如HVGA (320&#215;480) ldpi里面主要放低分辨率的图片,如QVGA (240&#215;320)]]></description>
			<content:encoded><![CDATA[<p>1. Android中图标尺寸：</p>
<p>AndroidManifest.xml中指定图标，名字不一定非叫icon<br />
&lt;application android:icon=”@drawable/icon” android:label=”@string/app_name”&gt;</p>
<p>2.0以后有三种尺寸，分别为36*36/48*48/72*72<br />
你会看到drawable-hdpi/drawable-ldpi/drawable-mdpi不同的目录用来存储不同尺寸的图标，在AndroidManifest.xml中只需要写@drawable/icon就可以，它会根据屏幕分辨率去找不同目录下的图标</p>
<p>hdpi里面主要放高分辨率的图片,如WVGA (480&#215;800),FWVGA (480&#215;854)<br />
mdpi里面主要放中等分辨率的图片,如HVGA (320&#215;480)<br />
ldpi里面主要放低分辨率的图片,如QVGA (240&#215;320)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=129</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>打字机图标练习</title>
		<link>http://www.uiair.com/?p=124</link>
		<comments>http://www.uiair.com/?p=124#comments</comments>
		<pubDate>Fri, 26 Aug 2011 04:15:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Vision]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=124</guid>
		<description><![CDATA[打字机图标练习]]></description>
			<content:encoded><![CDATA[<p>打字机图标练习</p>
<p><a href="http://www.uiair.com/wp-content/uploads/2011/08/Typewriter.png"><img class="aligncenter size-full wp-image-125" title="Typewriter" src="http://www.uiair.com/wp-content/uploads/2011/08/Typewriter.png" alt="打字机图标练习；icons" width="400" height="400" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=124</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>钢琴键盘练习</title>
		<link>http://www.uiair.com/?p=120</link>
		<comments>http://www.uiair.com/?p=120#comments</comments>
		<pubDate>Mon, 25 Jul 2011 05:38:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Vision]]></category>

		<guid isPermaLink="false">http://www.uiair.com/?p=120</guid>
		<description><![CDATA[钢琴键盘练习]]></description>
			<content:encoded><![CDATA[<p>钢琴键盘练习</p>
<p><a href="http://www.uiair.com/wp-content/uploads/2011/07/钢琴.png"><img class="aligncenter size-full wp-image-121" title="钢琴" src="http://www.uiair.com/wp-content/uploads/2011/07/钢琴.png" alt="" width="400" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.uiair.com/?feed=rss2&#038;p=120</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

