<?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>断桥残雪部落格css</title>
	<atom:link href="http://www.js8.in/tag/css/feed" rel="self" type="application/rss+xml" />
	<link>http://www.js8.in</link>
	<description>专注前端开发，分享JS、jQuery、PHP、CSS、WEB开发技巧</description>
	<lastBuildDate>Wed, 08 Sep 2010 09:58:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<ttl>30</ttl>
		<item>
		<title>引入CSS 的两种方式：link和@import的区别</title>
		<link>http://www.js8.in/554.html</link>
		<comments>http://www.js8.in/554.html#comments</comments>
		<pubDate>Sun, 20 Jun 2010 04:37:44 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=554</guid>
		<description><![CDATA[引入css外部文件的两种方法为在html页面通过link，src属性（注意空链接时的陷阱！），再者是通过CSS文件本身通过@import引入，虽然这两种方式都可以加载进来CSS文件，可是link和@import也存在着细微的差别。]]></description>
			<content:encoded><![CDATA[<p>引入<strong>css</strong>外部文件的两种方法为在html页面通过<strong>link</strong>，src属性（<a title="img,Script,Link等标签为空可导致页面多余请求" href="http://www.js8.in/555.html" target="_blank">注意空链接时的陷阱</a>！），再者是通过CSS文件本身通过<strong>@import url()</strong>引入，虽然这两种方式都可以加载进来CSS文件，可是link和@import也存在着细微的差别。</p>
<h3>隶属上的差别</h3>
<p>link属于XHTML标签，而@import完全是<strong>CSS</strong>提供的一种方式。link标签除了可以加载CSS外，还可以做很多其它的事情，比如定义RSS，定义rel连接属性等，@import就只能加载CSS了。此处注意<a title="img,Script,Link等标签为空可导致页面多余请求" href="http://www.js8.in/555.html" target="_blank">浏览器的link src为空时候时会导致页面加载次数增多</a>。</p>
<h3>@import次数限制</h3>
<p>传闻在IE6下，@import只能引入31次css文件，可是可以通过在css文件中再次import来垂直扩展，<a target="_blank" title="专注前端开发" href="http://js8.in" target="_blank">断桥残雪</a>没有测试过，不过如果出现这样的情况，说明这个写代码的人也挺变态的。</p>
<h3>加载顺序的不同</h3>
<p>当一个页面被加载的时候（就是被浏览者浏览的时候），link引用的CSS文件会同时被加载，而@import引用的CSS 会等到页面全部被下载完再被加载。所以有时候浏览@import加载CSS的页面时开始会没有样式，然后突然样式会出现，网速慢的时候还挺明显，@import这点跟把CSS文件放在页面结尾效果相同，不过如果我们一些样式开始页面并不会出现，而是在交互时才出现的CSS样式，可以通过这个方法引入，时间上错开。例如：Ajax的html，交互时的弹出框，弹出div等<br />
<span id="more-554"></span></p>
<h3>兼容性上的差别</h3>
<p>由于@import是CSS2.1提出的，@import只有在IE5以上的才能识别，而link标签无此问题（似乎影响不大~）。</p>
<h3>使用DOM控制样式时的差别</h3>
<p>当使用javascript控制DOM(<strong>document.styleSheets</strong>)去改变样式的时候，只能使用link标签，因为@import不是dom可以控制的。</p>
<p><span style="color: #ff6600;">所以，无特殊情况推荐使用link来引入样式，尽量避免使用@import，而如果进行Ajax或者交互的样式，则可以通过@import引入</span>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=引入CSS 的两种方式：link和@import的区别&#038; uri=http://www.js8.in/554.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=引入CSS 的两种方式：link和@import的区别&#038;bkmk=http://www.js8.in/554.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=引入CSS 的两种方式：link和@import的区别&#038;iu=http://www.js8.in/554.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/554.html&#038;title=引入CSS 的两种方式：link和@import的区别" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/554.html&#038;title=引入CSS 的两种方式：link和@import的区别" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=引入CSS 的两种方式：link和@import的区别&#038;rurl=http://www.js8.in/554.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=引入CSS 的两种方式：link和@import的区别&#038;url=http://www.js8.in/554.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=引入CSS 的两种方式：link和@import的区别&#038;url=http://www.js8.in/554.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=引入CSS 的两种方式：link和@import的区别&#038;url=http://www.js8.in/554.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/554.html" title="引入CSS 的两种方式：link和@import的区别">http://www.js8.in/554.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
<li><a href="http://www.js8.in/365.html" title="CSS清除浏览器默认样式注意点" rel="bookmark inlinks">CSS清除浏览器默认样式注意点</a></li>
<li><a href="http://www.js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载" rel="bookmark inlinks">CSS 3.0 参考手册 (中文版)下载</a></li>
<li><a href="http://www.js8.in/477.html" title="Less—让CSS如此简单" rel="bookmark inlinks">Less—让CSS如此简单</a></li>
<li><a href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/554.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>悼念地震，网站变灰CSS代码</title>
		<link>http://www.js8.in/528.html</link>
		<comments>http://www.js8.in/528.html#comments</comments>
		<pubDate>Tue, 20 Apr 2010 10:15:07 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=528</guid>
		<description><![CDATA[为了悼念地震中遇害的同胞，国家规定明天开始悼念日~下面贴出来使用CSS的IE滤镜代码实现网站变灰白的效果代码]]></description>
			<content:encoded><![CDATA[<p>为了悼念地震中遇害的同胞，国家规定明天开始悼念日~下面贴出来使用CSS的IE滤镜代码实现网站变灰白的效果代码，只在IE下有效~<br />
首先确定贵网站使用的是标准的doctype头，下面是html开头代码：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;</pre></div></div>

<p>然后使用下面的CSS代码</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span>
    filter<span style="color: #3333ff;">:progid</span><span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.BasicImage<span style="color: #00AA00;">&#40;</span>grayscale<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span> 
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>如果贵网站有Flash，那么请在&lt;object&gt;和&lt;&#038;/object&gt;之间插入一下代码：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;param value=”false” name=”menu”/&gt;
&lt;param value=”opaque” name=”wmode”/&gt;</pre></div></div>

<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=悼念地震，网站变灰CSS代码&#038; uri=http://www.js8.in/528.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=悼念地震，网站变灰CSS代码&#038;bkmk=http://www.js8.in/528.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=悼念地震，网站变灰CSS代码&#038;iu=http://www.js8.in/528.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/528.html&#038;title=悼念地震，网站变灰CSS代码" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/528.html&#038;title=悼念地震，网站变灰CSS代码" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=悼念地震，网站变灰CSS代码&#038;rurl=http://www.js8.in/528.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=悼念地震，网站变灰CSS代码&#038;url=http://www.js8.in/528.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=悼念地震，网站变灰CSS代码&#038;url=http://www.js8.in/528.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=悼念地震，网站变灰CSS代码&#038;url=http://www.js8.in/528.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码">http://www.js8.in/528.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/365.html" title="CSS清除浏览器默认样式注意点" rel="bookmark inlinks">CSS清除浏览器默认样式注意点</a></li>
<li><a href="http://www.js8.in/479.html" title="CSS+jQuery实现滑动幻灯片实例详解" rel="bookmark inlinks">CSS+jQuery实现滑动幻灯片实例详解</a></li>
<li><a href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
<li><a href="http://www.js8.in/477.html" title="Less—让CSS如此简单" rel="bookmark inlinks">Less—让CSS如此简单</a></li>
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/528.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>使用CSS设置文字反选的背景颜色</title>
		<link>http://www.js8.in/490.html</link>
		<comments>http://www.js8.in/490.html#comments</comments>
		<pubDate>Mon, 22 Feb 2010 03:51:39 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=490</guid>
		<description><![CDATA[本文通过设置css解决html页面中反选文字背景颜色的问题，也许很多人对这个问题不是很在意，也可能你早就见到过这个效果了，但是却忽略了。]]></description>
			<content:encoded><![CDATA[<p>在计算机操作中经常会有<strong>反选</strong>出现，系统一般会根据选择区域的颜色，显示出补色。但windows默认的文字选择时，背景为蓝色，前景色为白色，如果背景是深色，则文字为蓝色，<strong>背景</strong>变成白色。如下图所示：</p>
<div id="attachment_489" class="wp-caption aligncenter" style="width: 518px"><a href="http://www.js8.in/wp-content/uploads/2010/02/b201022115279.gif"><img class="size-full wp-image-489 " title="反选默认样式" src="http://www.js8.in/wp-content/uploads/2010/02/b201022115279.gif" alt="反选默认样式" width="508" height="38" /></a><p class="wp-caption-text">反选默认样式</p></div>
<p>能不能改变选择的默认颜色呢，也许很多人对这个问题不是很在意，也可能你早就见到过这个效果了，但是却忽略了。<a target="_blank" href="http://www.quirksmode.org/css/selection.html" target="_blank">查看示例</a>(<span style="color: #00ccff;">请在非IE浏览器下查看</span>)</p>
<p>从博客里可以看到PPK给出了如下的CSS代码：</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-moz-selection</span><span style="color: #00AA00;">&#123;</span>    <span style="color: #808080; font-style: italic;">/*针对Firefox*/</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#cc0000</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:selection </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#cc0000</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
code<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:-moz-selection </span><span style="color: #00AA00;">&#123;</span>  <span style="color: #808080; font-style: italic;">/*code是标签选择器，可以换成p或span等*/</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
code<span style="color: #00AA00;">:</span><span style="color: #3333ff;">:selection </span><span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333333</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</blockquote>
<p>通过以上代码可以看出，你完全可以给不同的容器定义不同的反选背景颜色，
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=使用CSS设置文字反选的背景颜色&#038; uri=http://www.js8.in/490.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=使用CSS设置文字反选的背景颜色&#038;bkmk=http://www.js8.in/490.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=使用CSS设置文字反选的背景颜色&#038;iu=http://www.js8.in/490.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/490.html&#038;title=使用CSS设置文字反选的背景颜色" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/490.html&#038;title=使用CSS设置文字反选的背景颜色" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=使用CSS设置文字反选的背景颜色&#038;rurl=http://www.js8.in/490.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=使用CSS设置文字反选的背景颜色&#038;url=http://www.js8.in/490.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=使用CSS设置文字反选的背景颜色&#038;url=http://www.js8.in/490.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=使用CSS设置文字反选的背景颜色&#038;url=http://www.js8.in/490.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色">http://www.js8.in/490.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
<li><a href="http://www.js8.in/479.html" title="CSS+jQuery实现滑动幻灯片实例详解" rel="bookmark inlinks">CSS+jQuery实现滑动幻灯片实例详解</a></li>
<li><a href="http://www.js8.in/477.html" title="Less—让CSS如此简单" rel="bookmark inlinks">Less—让CSS如此简单</a></li>
<li><a href="http://www.js8.in/554.html" title="引入CSS 的两种方式：link和@import的区别" rel="bookmark inlinks">引入CSS 的两种方式：link和@import的区别</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/490.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS+jQuery实现滑动幻灯片实例详解</title>
		<link>http://www.js8.in/479.html</link>
		<comments>http://www.js8.in/479.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 02:18:01 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=479</guid>
		<description><![CDATA[今天我看见一个比较不错的jQuery幻灯片教程，比我之前的文章《两个简单的jQuery幻灯片实例》写的更为详细，并且有框架布局的演示图片，特地转载来，部分英文不翻译了，很简单的~]]></description>
			<content:encoded><![CDATA[<p>今天我看见一个比较不错的<strong>jQuery幻灯片</strong>教程，比我之前的文章《<a title="两个简单的jQuery幻灯片实例" href="http://www.js8.in/462.html" target="_blank">两个简单的jQuery幻灯片实例</a>》写的更为详细，并且有框架布局的演示图片，特地转载来，部分英文不翻译了，很简单的~</p>
<h3>HTML部分代码</h3>
<p>Start with having a wrapping container div called <em>main_view</em>, and two sections nested inside called <em>image_reel</em> and <em>paging.</em> The <em>image_reel </em>will contain the sliding images, and <em>paging</em> contains the paging controls. Take a look at the image below for a visual.</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;main_view&quot;&gt;
    &lt;div class=&quot;window&quot;&gt;
        &lt;div class=&quot;image_reel&quot;&gt;
            &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;reel_1.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
            &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;reel_2.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
            &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;reel_3.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
            &lt;a href=&quot;#&quot;&gt;&lt;img src=&quot;reel_4.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;paging&quot;&gt;
        &lt;a href=&quot;#&quot; rel=&quot;1&quot;&gt;1&lt;/a&gt;
        &lt;a href=&quot;#&quot; rel=&quot;2&quot;&gt;2&lt;/a&gt;
        &lt;a href=&quot;#&quot; rel=&quot;3&quot;&gt;3&lt;/a&gt;
        &lt;a href=&quot;#&quot; rel=&quot;4&quot;&gt;4&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre></div></div>

</blockquote>
<div id="attachment_478" class="wp-caption aligncenter" style="width: 585px"><a href="http://www.js8.in/mywork/jq_slider/"><img class="size-full wp-image-478" title="css+jQuery实现滑动幻灯片实例教程" src="http://www.js8.in/wp-content/uploads/2010/02/1.jpg" alt="css+jQuery实现滑动幻灯片实例教程" width="575" height="270" /></a><p class="wp-caption-text">css+jQuery实现滑动幻灯片实例教程</p></div><br />
<span id="more-479"></span></p>
<h3>CSS部分代码</h3>
<p>Take a look at the comments below for an explanation of the styles.</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*--Main Container--*/</span>
<span style="color: #6666ff;">.main_view</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #808080; font-style: italic;">/*--Window/Masking Styles--*/</span>
<span style="color: #6666ff;">.window</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">286px</span><span style="color: #00AA00;">;</span>	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">790px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Hides anything outside of the set width/height--*/</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.image_reel</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.image_reel</span> img <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*--Paging Styles--*/</span>
<span style="color: #6666ff;">.paging</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-7px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">178px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">47px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Assures the paging stays on the top layer--*/</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span>paging_bg2.png<span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/*--Hidden by default, will be later shown with jQuery--*/</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paging</span> a <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paging</span> a<span style="color: #6666ff;">.active</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#920000</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#610000</span><span style="color: #00AA00;">;</span>
	-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-khtml-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
	-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.paging</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

</blockquote>
<h3>JS部分代码</h3>
<p>The following script contains comments explaining which jQuery actions are being performed.<br />
<strong>1.Setting up the Image Slider</strong><br />
Start by showing the paging and activating the first link. Then we will calculate and adjust the width of the <em>image_reel </em>according to how many slides there are.</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Show the paging and activate its first link</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.paging&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.paging a:first&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;active&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//Get size of the image, how many images there are, then determin the size of the image reel.</span>
<span style="color: #003366; font-weight: bold;">var</span> imageWidth <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.window&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> imageSum <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.image_reel img&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> imageReelWidth <span style="color: #339933;">=</span> imageWidth <span style="color: #339933;">*</span> imageSum<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//Adjust the image reel to its new size</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.image_reel&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'width'</span> <span style="color: #339933;">:</span> imageReelWidth<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</blockquote>
<p><strong>2.Setting up the Slider Function and Timer</strong><br />
We first create the function for the slide event by itself (<em>rotate</em>). Then create another function (<em>rotateSwitch</em>) that will rotate and repeat that slide event (rotate).</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Paging  and Slider Function</span>
rotate <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> triggerID <span style="color: #339933;">=</span> $active.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rel&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Get number of times to slide</span>
    <span style="color: #003366; font-weight: bold;">var</span> image_reelPosition <span style="color: #339933;">=</span> triggerID <span style="color: #339933;">*</span> imageWidth<span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Determines the distance the image reel needs to slide</span>
&nbsp;
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.paging a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Remove all active class</span>
    $active.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'active'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Add active class (the $active is declared in the rotateSwitch function)</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">//Slider Animation</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.image_reel&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        left<span style="color: #339933;">:</span> <span style="color: #339933;">-</span>image_reelPosition
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">500</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #006600; font-style: italic;">//Rotation  and Timing Event</span>
rotateSwitch <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    play <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//Set timer - this will repeat itself every 7 seconds</span>
        $active <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.paging a.active'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Move to the next paging</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> $active.<span style="color: #660066;">length</span> <span style="color: #339933;">===</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//If paging reaches the end...</span>
            $active <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.paging a:first'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//go back to first</span>
        <span style="color: #009900;">&#125;</span>
        rotate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Trigger the paging and slider function</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">7000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Timer speed in milliseconds (7 seconds)</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
rotateSwitch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Run function on launch</span></pre></div></div>

</blockquote>
<p>Take a look at this <a target="_blank" href="http://jquery-howto.blogspot.com/2009/04/ajax-update-content-every-x-seconds.html" target="_blank">tutorial</a> for an explanation of how the timer (<em>setInterval</em>) works.</p>
<p><strong>3.Hover and Click Events</strong><br />
In case the user wants to view the slide for a longer period of time, we will allow the slider to stop when it is hovered. Another thing to consider is we should reset the timer each time the paging is clicked. This will prevent unexpected slide switches and allow for a smoother experience.</p>
<blockquote>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//On Hover</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.image_reel a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">hover</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    clearInterval<span style="color: #009900;">&#40;</span>play<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Stop the rotation</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    rotateSwitch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Resume rotation timer</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
&nbsp;
<span style="color: #006600; font-style: italic;">//On Click</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.paging a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    $active <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Activate the clicked paging</span>
    <span style="color: #006600; font-style: italic;">//Reset Timer</span>
    clearInterval<span style="color: #009900;">&#40;</span>play<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Stop the rotation</span>
    rotateSwitch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// Resume rotation timer</span>
    rotate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Trigger rotation immediately</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//Prevent browser jump to link anchor</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</blockquote>
<p><div id="attachment_478" class="wp-caption aligncenter" style="width: 585px"><a href="http://www.js8.in/wp-content/uploads/2010/02/1.jpg"><img class="size-full wp-image-478" title="css+jQuery实现滑动幻灯片实例教程" src="http://www.js8.in/wp-content/uploads/2010/02/1.jpg" alt="css+jQuery实现滑动幻灯片实例教程" width="575" height="270" /></a><p class="wp-caption-text">css+jQuery实现滑动幻灯片实例教程</p></div>
<p class="demoview"><a target="_blank" href="http://www.js8.in/mywork/jq_slider/" >查看演示</a></p>
<h3>一些网站实例</h3>
<p>Below are some sites that use similar techniques, check them out for inspiration!</p>
<p style="text-align: center;"><a target="_blank" href="http://www.netdreams.co.uk/" target="_blank"><img class="center aligncenter" src="http://www.sohtanaka.com/web-design/examples/image-slider/sample1.jpg" alt="Automatic Image Slider CSS jQuery" width="575" height="270" /></a></p>
<p><a target="_blank" href="http://tutorial9.com/" target="_blank"><img class="center" src="http://www.sohtanaka.com/web-design/examples/image-slider/sample2.jpg" alt="Automatic Image Slider CSS jQuery" /></a></p>
<p><a target="_blank" href="http://radiumlabs.com/" target="_blank"><img class="center" src="http://www.sohtanaka.com/web-design/examples/image-slider/sample3.jpg" alt="Automatic Image Slider CSS jQuery" /></a></p>
<p><a target="_blank" href="http://www.bigspaceship.com/" target="_blank"><img class="center" src="http://www.sohtanaka.com/web-design/examples/image-slider/sample4.jpg" alt="Automatic Image Slider CSS jQuery" /></a></p>
<p><a target="_blank" href="http://electricpulp.com/" target="_blank"><img class="center" src="http://www.sohtanaka.com/web-design/examples/image-slider/sample5.jpg" alt="Automatic Image Slider CSS jQuery" /></a>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=CSS+jQuery实现滑动幻灯片实例详解&#038; uri=http://www.js8.in/479.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=CSS+jQuery实现滑动幻灯片实例详解&#038;bkmk=http://www.js8.in/479.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=CSS+jQuery实现滑动幻灯片实例详解&#038;iu=http://www.js8.in/479.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/479.html&#038;title=CSS+jQuery实现滑动幻灯片实例详解" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/479.html&#038;title=CSS+jQuery实现滑动幻灯片实例详解" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=CSS+jQuery实现滑动幻灯片实例详解&#038;rurl=http://www.js8.in/479.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=CSS+jQuery实现滑动幻灯片实例详解&#038;url=http://www.js8.in/479.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=CSS+jQuery实现滑动幻灯片实例详解&#038;url=http://www.js8.in/479.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=CSS+jQuery实现滑动幻灯片实例详解&#038;url=http://www.js8.in/479.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/479.html" title="CSS+jQuery实现滑动幻灯片实例详解">http://www.js8.in/479.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/501.html" title="IE中Image.onload失效的问题" rel="bookmark inlinks">IE中Image.onload失效的问题</a></li>
<li><a href="http://www.js8.in/337.html" title="jQuery浏览器判断一个bug，以及修改建议" rel="bookmark inlinks">jQuery浏览器判断一个bug，以及修改建议</a></li>
<li><a href="http://www.js8.in/464.html" title="使用hash来实现Ajax前进后退" rel="bookmark inlinks">使用hash来实现Ajax前进后退</a></li>
<li><a href="http://www.js8.in/283.html" title="jQuery+google weather API轻松实现天气地图（二）" rel="bookmark inlinks">jQuery+google weather API轻松实现天气地图（二）</a></li>
<li><a href="http://www.js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载" rel="bookmark inlinks">CSS 3.0 参考手册 (中文版)下载</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/479.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Less—让CSS如此简单</title>
		<link>http://www.js8.in/477.html</link>
		<comments>http://www.js8.in/477.html#comments</comments>
		<pubDate>Mon, 08 Feb 2010 01:47:27 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.js8.in/477.html</guid>
		<description><![CDATA[less 的出现便是为了解决浏览器兼容这个问题：在现有CSS syntax 的基础上，为CSS 加入程式语言的特性，包括变数、scope、nested rules、运算、继承。]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.js8.in/wp-content/uploads/2010/02/less.png"><img class="aligncenter size-full wp-image-476" title="less" src="http://www.js8.in/wp-content/uploads/2010/02/less.png" alt="less" width="480" height="96" /></a></p>
<p>写<strong>CSS</strong> 最痛苦的是要搞定一堆<strong>浏览器兼容</strong>bug ，其次就是要面对CSS 不是programming language 这现实，不存在其他程式语言常见的变数、运算、继承等概念，使原本简单的工作变得冗长，并且使维护工作变得麻烦。<br />
<strong>less</strong> 的出现便是为了解决这个问题：在现有CSS syntax 的基础上，为CSS 加入程式语言的特性，包括变数、scope、nested rules、运算、继承。<br />
看例子你便会明白：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@brand_color: #F0F;</span>
&nbsp;
<span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span>
div <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@brand_color;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
p <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@brand_color;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><span id="more-477"></span>这例子应该很容易理解吧，相等于以往的：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#container</span> div <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#F0F</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#container</span> p <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#F0F</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>坏消息是，用less 写成的档案需要在Unix based 的电脑上编译过后方能变成真正的CSS；好消息是，有人写了个小工具less.app 可以完成这项工作，使不懂得用terminal的用户也能够使用。在 window 下貌似没有简单的解法…<br />
less 官方网站：<a target="_blank" href="http://lesscss.org/" target="_self">http://lesscss.org/</a><br />
less.app (GUI): <a target="_blank" href="http://incident57.com/less/" target="_blank">http://incident57.com/less/</a>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=Less—让CSS如此简单&#038; uri=http://www.js8.in/477.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=Less—让CSS如此简单&#038;bkmk=http://www.js8.in/477.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=Less—让CSS如此简单&#038;iu=http://www.js8.in/477.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/477.html&#038;title=Less—让CSS如此简单" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/477.html&#038;title=Less—让CSS如此简单" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=Less—让CSS如此简单&#038;rurl=http://www.js8.in/477.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=Less—让CSS如此简单&#038;url=http://www.js8.in/477.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=Less—让CSS如此简单&#038;url=http://www.js8.in/477.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=Less—让CSS如此简单&#038;url=http://www.js8.in/477.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/477.html" title="Less—让CSS如此简单">http://www.js8.in/477.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
<li><a href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
<li><a href="http://www.js8.in/479.html" title="CSS+jQuery实现滑动幻灯片实例详解" rel="bookmark inlinks">CSS+jQuery实现滑动幻灯片实例详解</a></li>
<li><a href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
<li><a href="http://www.js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载" rel="bookmark inlinks">CSS 3.0 参考手册 (中文版)下载</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/477.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>png在IE6下透明的几种方法</title>
		<link>http://www.js8.in/448.html</link>
		<comments>http://www.js8.in/448.html#comments</comments>
		<pubDate>Fri, 15 Jan 2010 02:47:44 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[IE6]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=448</guid>
		<description><![CDATA[png透明针对IE6一直是件挺麻烦的事情，使用的方法也是各有不同，大多的原理是用IE的滤镜来解决的。本文通过css方法、js方法、htc三种方法来实现IE6下png透明，其中断桥残雪推荐使用htc方法]]></description>
			<content:encoded><![CDATA[<p>断桥残雪在《<a href="http://www.js8.in/380.html" target="_blank" title="IE6 PNG图片不透明问题的解决方法">IE6 PNG图片不透明问题的解决方法</a>》中提到了使用js来解决IE6下PNG图片不透明的问题，今天我总结一下png在IE6下透明的方法：<strong>css方法</strong>、<strong>js方法</strong>、<strong>htc方法</strong>。</p>
<p>png透明针对IE6一直是件挺麻烦的事情，使用的方法也是各有不同，大多的原理是用IE的滤镜来解决的。</p>
<blockquote><p>语法：<br />
filter : progid:DXImageTransform.Microsoft.AlphaImageLoader ( enabled=bEnabled , sizingMethod=sSize , src=sURL )</p>
<p style="text-indent:0">enabled : 可选项。布尔值(Boolean)。设置或检索滤镜是否激活。true | false true : 默认值。滤镜激活。<br />
false : 滤镜被禁止。<br />
sizingMethod : 可选项。字符串(String)。设置或检索滤镜作用的对象的图片在对象容器边界内的显示方式。 crop : 剪切图片以适应对象尺寸。<br />
image : 默认值。增大或减小对象的尺寸边界以适应图片的尺寸。scale : 缩放图片以适应对象的尺寸边界。<br />
src : 必选项。字符串(String)。使用绝对或相对 url 地址指定背景图像。假如忽略此参数，滤镜将不会作用。</p>
</blockquote>
<p>现在一般在使用的方法有以下几种：<br />
<span id="more-448"></span></p>
<h3>1、css方法</h3>
<blockquote><p>
<strong>css</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.pngs</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">90px</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;">90px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span><span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">icon_home.png</span><span style="color: #00AA00;">&#41;</span>!important<span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* FF IE7 */</span>
<span style="color: #000000; font-weight: bold;">background-repeat</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span> _filter<span style="color: #00AA00;">:</span> progid<span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span>.AlphaImageLoader<span style="color: #00AA00;">&#40;</span>src<span style="color: #00AA00;">=</span>’icon_home.png’<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>  <span style="color: #808080; font-style: italic;">/* IE6 */</span>
_ <span style="color: #000000; font-weight: bold;">background-image</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* IE6 */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>xhtml</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=”pngs”&gt;&lt;/div&gt;</pre></div></div>

</blockquote>
<p>这种方法的优点就是使用简单方便，但是不能作为背景，且只能用作单个png图片的使用。如果要作为背景，需要新增加一个div层，并设置其position:relative;</p>
<blockquote><p>
<strong>css</strong>：</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.png</span> div<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><strong>xhml</strong>:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=’png’&gt;
&lt;div&gt;
CSS 背景PNG透明 及 链接失效问题解决
&lt;/div&gt;
&lt;/div&gt;</pre></div></div>

</blockquote>
<p>这种方法可以使用在那些png图片不多，且不需要repeat的情况下。</p>
<h3>2、js方法</h3>
<pre lang=”javascript”>
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 &#038; 6.
{
    var arVersion = navigator.appVersion.split(“MSIE”)
    var version = parseFloat(arVersion[1])
    if ((version >= 5.5) &#038;&#038; (document.body.filters))
    {
       for(var j=0; j<document.images.length; j++)
       {
          var img = document.images[j]
          var imgName = img.src.toUpperCase()
          if (imgName.substring(imgName.length-3, imgName.length) == “PNG”)
          {
             var imgID = (img.id) ? “id=’” + img.id + “‘ ” : “”
             var imgClass = (img.className) ? “class=’” + img.className + “‘ ” : “”
             var imgTitle = (img.title) ? “title=’” + img.title + “‘ ” : “title=’” + img.alt + “‘ ”
             var imgStyle = “display:inline-block;” + img.style.cssText
             if (img.align == “left”) imgStyle = “float:left;” + imgStyle
             if (img.align == “right”) imgStyle = “float:right;” + imgStyle
             if (img.parentElement.href) imgStyle = “cursor:hand;” + imgStyle
             var strNewHTML = “<span ” + imgID + imgClass + imgTitle
             + ” style=\”" + “width:” + img.width + “px; height:” + img.height + “px;” + imgStyle + “;”
             + “filter:progid:DXImageTransform.Microsoft.AlphaImageLoader”
             + “(src=\’” + img.src + “\’, sizingMethod=’scale’);\”></span>”
             img.outerHTML = strNewHTML
             j = j-1
          }
       }
    }
}
window.attachEvent(“onload”, correctPNG);
</pre>
<p>这种js先判断是否IE，然后判断ie版本，版本在6.0下则判定函数，给png的图片添加滤镜。<br />
使用起来的确方便，无论多少图片都可以解决，但是依然无法repeat。</p>
<h3>3、htc方法</h3>
<p>htc相当于完全通过插件的方法修复的IE6的bug，功能强大，支持repeat，背景等功能，使用起来也很方便。<br />
使用一个<strong>iepngfix.htc</strong> 文件，和一个透明的gif文件。</p>
<p>使用方法：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!–[if lte IE 6]&gt;
&lt;style&gt;.png{behavior:url(“iepngfix.htc”);}&lt;/style&gt;  //在这里可以加入其他用到png图片的id或者class
&lt;script type=”text/javascript” src=”iepngfix_tilebg.js”&gt;&lt;/script&gt;
&lt;![endif]–&gt;</pre></div></div>

<p>ps：如果需要repeat背景，往往需要设置这个div 宽度为100%。</p>
<p>关于<strong>iepngfix.htc</strong>的详细用法以及<a target="_blank" href="http://www.twinhelix.com/css/iepngfix/demo/" target='_blank'>Demo</a>，请<a target="_blank" href="http://www.twinhelix.com/css/iepngfix/demo/" target='_blank'>狂点此处</a></p>
<h3>总结</h3>
<p>总结这几种方法，第三种方法（<strong>htc方法</strong>）是最简单实用，且容易推广的方法，建议可以做个公共的地址，有产品需要，只需要应用这个公共地址就行了。
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=png在IE6下透明的几种方法&#038; uri=http://www.js8.in/448.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=png在IE6下透明的几种方法&#038;bkmk=http://www.js8.in/448.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=png在IE6下透明的几种方法&#038;iu=http://www.js8.in/448.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/448.html&#038;title=png在IE6下透明的几种方法" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/448.html&#038;title=png在IE6下透明的几种方法" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=png在IE6下透明的几种方法&#038;rurl=http://www.js8.in/448.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=png在IE6下透明的几种方法&#038;url=http://www.js8.in/448.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=png在IE6下透明的几种方法&#038;url=http://www.js8.in/448.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=png在IE6下透明的几种方法&#038;url=http://www.js8.in/448.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法">http://www.js8.in/448.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/620.html" title="关于wBox iFrame回调关闭问题的解决方案" rel="bookmark inlinks">关于wBox iFrame回调关闭问题的解决方案</a></li>
<li><a href="http://www.js8.in/554.html" title="引入CSS 的两种方式：link和@import的区别" rel="bookmark inlinks">引入CSS 的两种方式：link和@import的区别</a></li>
<li><a href="http://www.js8.in/557.html" title="解决IE6背景图片不缓存的BUG" rel="bookmark inlinks">解决IE6背景图片不缓存的BUG</a></li>
<li><a href="http://www.js8.in/529.html" title="通过javascript实现整站黑白效果" rel="bookmark inlinks">通过javascript实现整站黑白效果</a></li>
<li><a href="http://www.js8.in/331.html" title="14条JS代码编写时最佳规范" rel="bookmark inlinks">14条JS代码编写时最佳规范</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/448.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS清除浏览器默认样式注意点</title>
		<link>http://www.js8.in/365.html</link>
		<comments>http://www.js8.in/365.html#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:15:20 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.js8.in/?p=365</guid>
		<description><![CDATA[今天看了岁月如歌的一片文章《KISSY CSS Reset 1.0》其中写到了css重置的代码
/*
KISSY CSS Reset
理念：1. reset 的目的不是清除浏览器的默认样式，这仅是部分工作。清除和重置是紧密不可分的。
2. reset 的目的不是让默认样式在所有浏览器下一致，而是减少默认样式有可能带来的问题。
3. reset 期望提供一套普适通用的基础样式。但没有银弹，推荐根据具体需求，裁剪和修改后再使用。
特色：1. 适应中文；2. 基于最新主流浏览器。
维护：玉伯, 正淳
Revision: 276
*/
/** 清除内外边距 **/
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */
dl, dt, dd, ul, ol, li, /* list elements 列表元素 */
pre, /* text formatting elements 文本格式元素 */
form, fieldset, legend, button, input, textarea, /* form [...]]]></description>
			<content:encoded><![CDATA[<p>今天看了岁月如歌的一片文章《<a target="_blank" href="http://lifesinger.org/blog/2009/12/kissy-css-reset/" target="_blank">KISSY CSS Reset 1.0</a>》其中写到了<strong>css重置</strong>的代码</p>
<blockquote><p>/*<br />
KISSY CSS Reset<br />
理念：1. reset 的目的不是清除浏览器的默认样式，这仅是部分工作。清除和重置是紧密不可分的。<br />
2. reset 的目的不是让默认样式在所有浏览器下一致，而是减少默认样式有可能带来的问题。<br />
3. reset 期望提供一套普适通用的基础样式。但没有银弹，推荐根据具体需求，裁剪和修改后再使用。<br />
特色：1. 适应中文；2. 基于最新主流浏览器。<br />
维护：玉伯, 正淳<br />
Revision: 276<br />
*/</p>
<p>/** 清除内外边距 **/<br />
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* structural elements 结构元素 */<br />
dl, dt, dd, ul, ol, li, /* list elements 列表元素 */<br />
pre, /* text formatting elements 文本格式元素 */<br />
form, fieldset, legend, button, input, textarea, /* form elements 表单元素 */<br />
th, td /* table elements 表格元素 */ {<br />
margin: 0;<br />
padding: 0;<br />
}</p>
<p>/** 设置默认字体 **/<br />
body,<br />
button, input, select, textarea /* for ie */ {<br />
font: 12px/1.5 tahoma, arial, simsun, sans-serif;<br />
}<br />
h1, h2, h3, h4, h5, h6 { font-size: 100%; }<br />
address, cite, dfn, em, var { font-style: normal; } /* 将斜体扶正 */<br />
code, kbd, pre, samp { font-family: courier new, courier, monospace; } /* 统一等宽字体 */<br />
small { font-size: 12px; } /* 小于 12px 的中文很难阅读，让 small 正常化 */</p>
<p>/** 重置列表元素 **/<br />
ul, ol { list-style: none; }</p>
<p>/** 重置文本格式元素 **/<br />
a { text-decoration: none; }<br />
a:hover { text-decoration: underline; }</p>
<p>sup { vertical-align: text-top; } /* 重置，减少对行高的影响 */<br />
sub { vertical-align: text-bottom; }</p>
<p>/** 重置表单元素 **/<br />
legend { color: #000; } /* for ie6 */<br />
fieldset, img { border: 0; } /* img 搭车：让链接里的 img 无边框 */<br />
button, input, select, textarea { font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */<br />
/* 注：optgroup 无法扶正 */</p>
<p>/** 重置表格元素 **/<br />
table { border-collapse: collapse; border-spacing: 0; }</p></blockquote>
<p>而我在腾讯webteam中看到一篇文章《<a target="_blank" href="http://webteam.tencent.com/?p=1481" target="_blank">border:none;与border:0;的区别</a>》中提到<br />
<span id="more-365"></span><br />
<blockquote><strong>1.性能差异</strong><br />
【border:0;】把border设为“0”像素虽然在页面上看不见，但按border默认值理解，浏览器依然对border-width/border-color进行了渲染，即已经占用了内存值。<br />
【border:none;】把border设为“none”即没有，浏览器解析“none”时将不作出渲染动作，即不会消耗内存值。<br />
<strong >2.兼容性差异</strong><br />
兼容性差异只针对浏览器IE6、IE7与标签button、input而言，在win、win7、vista 的XP主题下均会出现此情况。<br />
【border:none;】当border为“none”时似乎对IE6/7无效边框依然存在<br />
【border:0;】当border为“0”时，感觉比“none”更有效，所有浏览器都一致把边框隐藏<br />
<strong >总结：</strong><br />
1. 对比border:0;与border:none;之间的区别在于有渲染和没渲染，感觉他们和display:none;与visibility:hidden;的关系类似，而对于border属性的渲染性能对比暂时没找测试的方法，虽然认为他们存在渲染性能上的差异但也只能说是理论上。</p>
<p>2. 如何让border:none;实现全兼容？只需要在同一选择符上添加背景属性即可，<br />
对于border:0;与border:none;个人更向于使用,border:none;，因为border:none;毕竟在性能消耗没有争议，而且兼容性可用背景属性解决不足以成为障碍。
</p></blockquote>
<p>所以建议大家根据自己的实际情况做判断使用<strong>border:none;</strong> 或者<strong> border:0;</strong>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=CSS清除浏览器默认样式注意点&#038; uri=http://www.js8.in/365.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=CSS清除浏览器默认样式注意点&#038;bkmk=http://www.js8.in/365.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=CSS清除浏览器默认样式注意点&#038;iu=http://www.js8.in/365.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/365.html&#038;title=CSS清除浏览器默认样式注意点" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/365.html&#038;title=CSS清除浏览器默认样式注意点" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=CSS清除浏览器默认样式注意点&#038;rurl=http://www.js8.in/365.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=CSS清除浏览器默认样式注意点&#038;url=http://www.js8.in/365.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=CSS清除浏览器默认样式注意点&#038;url=http://www.js8.in/365.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=CSS清除浏览器默认样式注意点&#038;url=http://www.js8.in/365.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/365.html" title="CSS清除浏览器默认样式注意点">http://www.js8.in/365.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/479.html" title="CSS+jQuery实现滑动幻灯片实例详解" rel="bookmark inlinks">CSS+jQuery实现滑动幻灯片实例详解</a></li>
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
<li><a href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
<li><a href="http://www.js8.in/477.html" title="Less—让CSS如此简单" rel="bookmark inlinks">Less—让CSS如此简单</a></li>
<li><a href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/365.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS 3.0 参考手册 (中文版)下载</title>
		<link>http://www.js8.in/343.html</link>
		<comments>http://www.js8.in/343.html#comments</comments>
		<pubDate>Mon, 23 Nov 2009 01:33:32 +0000</pubDate>
		<dc:creator>断桥残雪</dc:creator>
				<category><![CDATA[网络技术]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[工具]]></category>

		<guid isPermaLink="false">http://www.js8.in/343.html</guid>
		<description><![CDATA[原文来自：腾讯webteam
CSS 是 Cascading Style Sheet 的缩写。译作「层叠样式表」。是用于(增强)控制网页样式并允许将样式信息与网页内容分离的一种标记性语言。
手册难点

中文资料少，对英文翻译功底要求较高；
基础语法要求字斟句酌，避免产生歧义；
兼容性列表涉及浏览器及版本众多；
草案中的Grid布局被业界同仁普遍认为比“天书”还难…

CSS3 还是草案，中文资料少之又少，基本上都是一篇内容转来转去，而我们的手册从基础语法到示例制作，都是根据W3C工作草案进行翻译，并结合自身的沉淀制作示例。
备受期待的 CSS 3 新功能
圆角、多背景、@font-face 用户自定义字体、动画与渐变、渐变色、盒阴影、RGBa &#8211; 加入透明色、文字阴影等等
CSS3 的出现，让代码更简洁、页面结构更合理，性能和效果得到兼顾。

CSS 3.0 参考手册 (中文版) 预览：

下载：
CSS 3.0 参考手册 (中文版) 下载 (366k)
收藏本文到：QQ书签 &#124; Google书签 &#124; 百度搜藏 &#124; 人人网 &#124; 豆瓣 &#124; 开心网 &#124; Yahoo收藏 &#124; 新浪ViVi &#124; 乐收声明：文章未声明为原创文章，本文链接 http://www.js8.in/343.html. 转载请注明转自 JS8.IN ™
相关文章

引入CSS 的两种方式：link和@import的区别
使用CSS设置文字反选的背景颜色
CSS+jQuery实现滑动幻灯片实例详解
CSS清除浏览器默认样式注意点
png在IE6下透明的几种方法

]]></description>
			<content:encoded><![CDATA[<p>原文来自：<a target="_blank" href="http://webteam.tencent.com/css3/" target="_blank">腾讯webteam</a></p>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; display: block; font-size: 1.2em; text-indent: 0px; padding: 0px;"><span style="background-color: #ffffff;">CSS 是 Cascading Style Sheet 的缩写。译作「层叠样式表」。是用于(增强)控制网页样式并允许将样式信息与网页内容分离的一种标记性语言。</span></p>
<h2 style="margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-size: 14px; clear: both; color: #454545; font-family: georgia; padding: 0px;">手册难点</h2>
<ol style="padding: 0px; margin: 0px;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 24px; font-size: 1.2em; line-height: 12px; padding: 0px;">中文资料少，对英文翻译功底要求较高；</li>
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 24px; font-size: 1.2em; line-height: 12px; padding: 0px;">基础语法要求字斟句酌，避免产生歧义；</li>
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 24px; font-size: 1.2em; line-height: 12px; padding: 0px;">兼容性列表涉及浏览器及版本众多；</li>
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 24px; font-size: 1.2em; line-height: 12px; padding: 0px;">草案中的Grid布局被业界同仁普遍认为比“天书”还难…</li>
</ol>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; display: block; font-size: 1.2em; text-indent: 0px; padding: 0px;">CSS3 还是草案，中文资料少之又少，基本上都是一篇内容转来转去，而我们的手册从基础语法到示例制作，都是根据W3C工作草案进行翻译，并结合自身的沉淀制作示例。</p>
<h2 style="margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-size: 14px; clear: both; color: #454545; font-family: georgia; padding: 0px;">备受期待的 CSS 3 新功能</h2>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; display: block; font-size: 1.2em; text-indent: 0px; padding: 0px;">圆角、多背景、@font-face 用户自定义字体、动画与渐变、渐变色、盒阴影、RGBa &#8211; 加入透明色、文字阴影等等<br />
CSS3 的出现，让代码更简洁、页面结构更合理，性能和效果得到兼顾。</p>
<p><span id="more-343"></span></p>
<h2 style="margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-size: 14px; clear: both; color: #454545; font-family: georgia; padding: 0px;">CSS 3.0 参考手册 (中文版) 预览：</h2>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; display: block; font-size: 1.2em; text-indent: 0px; padding: 0px;"><img class="alignleft" style="padding: 0px; margin: 0px; border: 0px initial initial;" title="CSS 3.0 参考手册 (中文版) 预览" src="http://webteam.tencent.com/css3/css3_scrn.png" alt="" width="608" height="964" /></p>
<h2 style="margin-top: 15px; margin-right: 0px; margin-bottom: 5px; margin-left: 0px; font-size: 14px; clear: both; color: #454545; font-family: georgia; padding: 0px;">下载：</h2>
<p style="margin-top: 0px; margin-right: 0px; margin-bottom: 15px; margin-left: 0px; display: block; font-size: 1.2em; text-indent: 0px; padding: 0px;"><a target="_blank" style="color: #000000; text-decoration: underline; padding: 0px; margin: 0px;" href="http://webteam.tencent.com/css3/css3.0manual.chm.zip"><strong>CSS 3.0 参考手册 (中文版) 下载 (366k)</strong></a></p>
<div class="copyright"><span class="fav"><span class="icon"></span><span><strong>收藏本文到：</strong><a target="_blank" rel="nofollow" href="http://shuqian.qq.com/post?title=CSS 3.0 参考手册 (中文版)下载&#038; uri=http://www.js8.in/343.html" title="收藏本文到QQ书签" target="_blank">QQ书签</a> | <a target="_blank" rel="nofollow" href="http://www.google.com/bookmarks/mark?op=add&#038;hl=zh_cn&#038;title=CSS 3.0 参考手册 (中文版)下载&#038;bkmk=http://www.js8.in/343.html" title="收藏本文到Google书签" target="_blank">Google书签</a> | <a target="_blank" rel="nofollow" href="http://cang.baidu.com/do/add?it=CSS 3.0 参考手册 (中文版)下载&#038;iu=http://www.js8.in/343.html" title="收藏本文到百度搜藏" target="_blank">百度搜藏</a> | <a target="_blank" rel="nofollow" href=" http://share.renren.com/share/buttonshare.do?link=http://www.js8.in/343.html&#038;title=CSS 3.0 参考手册 (中文版)下载" title="收藏本文到人人网" target="_blank">人人网</a> | <a target="_blank" rel="nofollow" href="http://www.douban.com/recommend/?url=http://www.js8.in/343.html&#038;title=CSS 3.0 参考手册 (中文版)下载" title="收藏本文到豆瓣" target="_blank">豆瓣</a> | <a target="_blank" rel="nofollow" href="http://www.kaixin001.com/repaste/share.php?rtitle=CSS 3.0 参考手册 (中文版)下载&#038;rurl=http://www.js8.in/343.html" title="收藏本文到开心网" target="_blank">开心网</a> | <a target="_blank" rel="nofollow" href="http://myweb.cn.yahoo.com/popadd.html?title=CSS 3.0 参考手册 (中文版)下载&#038;url=http://www.js8.in/343.html" title="收藏本文到Yahoo收藏" target="_blank">Yahoo收藏</a> | <a target="_blank" rel="nofollow" href="http://vivi.sina.com.cn/collect/icollect.php?title=CSS 3.0 参考手册 (中文版)下载&#038;url=http://www.js8.in/343.html" title="收藏到新浪ViVi" target="_blank">新浪ViVi</a> | <a target="_blank" rel="nofollow" href="http://leshou.com/post?act=shou&#038;title=CSS 3.0 参考手册 (中文版)下载&#038;url=http://www.js8.in/343.html" title="收藏本文到乐收" target="_blank">乐收</a></span></span><span><span class="icon"></span><span><strong>声明：</strong>文章未声明为原创文章，本文链接 <a rel="external nofollow" href="http://www.js8.in/343.html" title="CSS 3.0 参考手册 (中文版)下载">http://www.js8.in/343.html</a>. 转载请注明转自<a rel="bookmark inlinks" href="http://www.js8.in" title="Theo Wong来自于青岛普加智能有限公司"> JS8.IN ™</a></span></span></div>
<h3>相关文章</h3>
<ul class="related_posts">
<li><a href="http://www.js8.in/477.html" title="Less—让CSS如此简单" rel="bookmark inlinks">Less—让CSS如此简单</a></li>
<li><a href="http://www.js8.in/554.html" title="引入CSS 的两种方式：link和@import的区别" rel="bookmark inlinks">引入CSS 的两种方式：link和@import的区别</a></li>
<li><a href="http://www.js8.in/490.html" title="使用CSS设置文字反选的背景颜色" rel="bookmark inlinks">使用CSS设置文字反选的背景颜色</a></li>
<li><a href="http://www.js8.in/448.html" title="png在IE6下透明的几种方法" rel="bookmark inlinks">png在IE6下透明的几种方法</a></li>
<li><a href="http://www.js8.in/528.html" title="悼念地震，网站变灰CSS代码" rel="bookmark inlinks">悼念地震，网站变灰CSS代码</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.js8.in/343.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
