<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Azuresky]]></title> 
<link>http://www.azuresky.com.cn/index.php</link> 
<description><![CDATA[Web旅途的过程...]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Azuresky]]></copyright>
<item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-HTML5NewTags.php</link>
<title><![CDATA[HTML5的新标签]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Wed, 07 Jul 2010 11:53:55 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-HTML5NewTags.php</guid> 
<description>
<![CDATA[ 
	关注Web发展的人们都几乎都知道html5的强大，都在讨论html5是否会取代并淘汰flash。<br/>本文并不对html5是否取代flash进行讨论，我们来看看html5除了有名的&lt;video&gt;标签外，还有什么新成员添加到html标签大家族。<br/><br/><strong>HTML5新增的标签分别有：</strong><br/><ul style="list-style:square outside;padding-left:14px;"><li><stront>图形媒体：</strong>canvas标签　audio标签　embed标签　video标签　source标签</li><li><stront>文档结构：</strong>header标签　nav标签　section标签　footer标签</li><li><stront>文档内容：</strong>article标签　aside标签　details标签　summary标签　hgroup标签　time标签　figure标签　figcaption标签</li><li><stront>表单元素：</strong>command标签　datalist标签</li><li><stront>其他文本：</strong>ruby标签　rp标签　rt标签　keygen标签　mark标签　meter标签　output标签　progress标签</li></ul><br/>............<br/><br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/html/" rel="tag">html</a> , <a href="http://www.azuresky.com.cn/go.php/tags/html5/" rel="tag">html5</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-IE8ToIE7Rendering.php</link>
<title><![CDATA[让IE8以IE7的渲染模式来渲染CSS]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Sun, 08 Mar 2009 02:50:03 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-IE8ToIE7Rendering.php</guid> 
<description>
<![CDATA[ 
	极少时候，需要用到<strong>IE8 CSS hack</strong><br/>但是网络搜索到的都是标题党，所提供的并不是真正的<strong>IE8 CSS hack</strong><br/>难道IE8没有专有的识别字符？<br/><br/>答案我也不知道，未发现。<br/>但是可以通过另外一种途径，使你的网页能像IE7那样显示。<br/>虽然我明白，IE8比IE7进步很多，网页标准的支持也更大<br/>渲染CSS上与Firefox非常接近了，在IE8上所见与Firefox几乎无异（极少差异，但却存在）。<br/>但是因为IE这个家族的其他两位重要成员IE6、IE7还是非常多人在使用，特别是IE7。<br/>目前截至2009年05月为止，IE7占有率为44.51%，IE6占有率为17.52%，IE8为3.99%<br/>IE6、IE7是网页设计师们重点的网页测试对象（这里所说的网页测试，是在浏览器中CSS布局的定位是否精确）。<br/>但是我们也得考虑IE8，IE8是的成熟是未来几年升级的对象，因该会有部分用户从IE6直接升级到IE8。<br/>因此我们一定要考虑IE8，把它纳入网页测试对象。<br/><br/>以上是我针对性的分析，言归正传。<br/><br/>微软IE设计团队在设计IE8的时候就为IE8浏览增加了兼容模式、IE7浏览模式。<br/>因此我们用微软提供的下代码可以在IE8浏览器中使用IE7的渲染模式来渲染CSS<br/><div class="code">&lt;meta http-equiv=&quot;x-ua-compatible&quot; content=&quot;ie=7&quot; /&gt;</div><br/>这是一个“思想”倒退的办法，但是能暂时解决在IE8中遇到的问题。<br/><br/>其实很少需要用到以上方法，前面说过，IE8上所见与Firefox几乎无异（极少差异，但却存在）。<br/>这个“几乎”就让我使用了一次“让IE8以IE7的渲染模式来渲染CSS”<br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/ie7/" rel="tag">ie7</a> , <a href="http://www.azuresky.com.cn/go.php/tags/ie8/" rel="tag">ie8</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-IE6ContentHeight100PerCent.php</link>
<title><![CDATA[使IE6中DIV(或其他容器)设置高度(height)为100%]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Wed, 04 Mar 2009 05:33:38 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-IE6ContentHeight100PerCent.php</guid> 
<description>
<![CDATA[ 
	当你在制作网页中用CSS定义一个DIV(或者其他容器，如table等...)的height:100%<br/>在IE6中此定义无法达到预期纵向(y)100%显示效果时<br/>以下方法可以帮你解决<br/><br/>首先请用CSS定义<br/><div class="code">body&#123;height:100%&#125;</div><br/>此定义是为了让本身body就具有height为100%<br/><br/>然后<br/>再定义你想让其达到高100%纵向满屏的DIV(或者其他容器)<strong>的父DIV(或者其他容器)</strong><br/>其高度亦为height:100%<br/><br/>注意加重字体所表达的意思<br/><br/><strong>即：<br/>你要定义一个DIV的高100%纵向满屏<br/>那么请先将其上级的DIV的高定义为100%<br/>上级有多少个DIV，你都要定义它们的高为100%<br/>这样才能达到包含在里面的DIV的高为浏览器高100%的纵向满屏效果。</strong><br/><br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/xhtml/" rel="tag">xhtml</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/div/" rel="tag">div</a> , <a href="http://www.azuresky.com.cn/go.php/tags/ie6/" rel="tag">ie6</a> , <a href="http://www.azuresky.com.cn/go.php/tags/height/" rel="tag">height</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-CSSHacks_Issues.php</link>
<title><![CDATA[CSS网页设计解决方案(Hacks  Issues)]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Fri, 13 Jun 2008 13:20:13 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-CSSHacks_Issues.php</guid> 
<description>
<![CDATA[ 
	<strong>&nbsp;&nbsp;&nbsp;&nbsp;1、说明本文阐述了8条我们发现的在用CSS设计中有用的解决方案。</strong><br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;2、浏览器特定的选择器</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;英文地址：&nbsp;&nbsp;<a href="http://www.solidstategroup.com/page/1592" target="_blank">http://www.solidstategroup.com/page/1592</a><br/><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;当你想在一个浏览器里改变样式而不像在其他浏览器中改变时，这些选择器很有用。<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;IE6以下</strong><br/><br/>&nbsp;&nbsp; *html&#123;&#125;<br/> <br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;IE 7 以下</strong><br/><br/>*:first-child+html &#123;&#125; * html &#123;&#125;<br/> <br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;只对IE 7</strong><br/><br/>*:first-child+html &#123;&#125;<br/> <br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;只对IE 7 和现代浏览器</strong><br/><br/>html&gt;body &#123;&#125;<br/> <br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;只对现代浏览器(非IE 7)</strong><br/><br/>html&gt;/**/body &#123;&#125;<br/> <br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;最新的Opera 9以下版本</strong><br/><br/>html:first-child &#123;&#125;<br/> <br/><strong>Safari</strong><br/><br/>html[xmlns*=”&quot;] body:last-child &#123;&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;要使用这些选择器，请在样式前写下这些代码。例如：<br/><br/>#content-box &#123;<br/>　　width: 300px;<br/>　　height: 150px;<br/>&#125;<br/>* html #content-box &#123;<br/>　　width: 250px;<br/>&#125;<br/>/* 重写上面的代码并且把宽度改为250px<br/>在IE6以下版本中适用。 */<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;3、在IE6中使用透明PNG图片</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;IE6的一个很难处理的BUG就是它不支持透明PNG图片。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;你可能需要用一个重写的CSS的滤镜来解决这个问题：<br/><br/>*html #image-style &#123;<br/>　　background-image: none;<br/>　　filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=”filename.png”, sizingMethod=”scale”);<br/>&#125;<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;4、去掉连接虚线框</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;当你点击链接时，Firefox会在链接周围产生一个虚线外框。<br/>　　<a href="http://www.azuresky.com.cn/attachment.php?fid=139" target="_blank"><img src="http://www.azuresky.com.cn/attachment.php?fid=139" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>&nbsp;&nbsp;&nbsp;&nbsp;这个很好解决，只需在a标签中添加outline:none就可以了。<br/><br/>a&#123;<br/>　　outline:none;<br/>&#125;<br/>注：此样式定义对IE6、IE7无效。但IE8有效<br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;5、对inline元素应用宽度。</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;如果你对一个inline元素使用宽度，它将只在IE6下起作用。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;所以的HTML标签要么是Block的要么就是inline的。inline属性的标签有&lt;span&gt;&lt;a&gt;&lt; strong&gt;和&lt;em&gt;Block标签包括&lt;div&gt;&lt;p&gt;&lt;h1&gt;&lt;form&gt; 和&lt;li&gt;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;你不能控制inilne标签的宽带，不过有一个方法是把标签属性从inline改为Block。<br/><br/>span&#123;<br/>　　width:150px;<br/>　　display:block;<br/>&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;应用display:block能够把span标签变成block标签，从而控制它的宽度。<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;6、使一个固定宽度的网站居中。</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;为了让你的网站在浏览器中居中，可以为最外层Div添加position:relative属性，然后将margin设为auto。<br/><br/>#wrapper &#123;<br/>　　margin: auto;<br/>　　position: relative;<br/>&#125;<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;7、图片替换技术</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;对于头部来说，永远是最好用文字而不是图片。在你必须要用图片的某个特殊地方最好使用隐藏文字的层的背景图片。这对于屏幕阅读和SEO非常有用，尽管依然使用很普通的文字，这可以联想到所有的优点。<br/><br/>HTML：<br/><br/>&lt;h1&gt;&lt;span&gt;Main heading one&lt;/span&gt;&lt;/h1&gt;<br/> <br/>CSS:<br/><br/>h1 &#123;<br/>　　background: url(heading-image.gif) no-repeat;<br/>&#125;<br/>h1 span &#123;<br/>　　position:absolute;<br/>　　text-indent: -5000px;<br/>&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;正如你所见，我们对H1标签使用普通的HTML代码，用CSS来将图片替代文字。Text-indent把文字放到左边5000像素处，从而用户看不到它们<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;8、最小宽度<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;IE的另外一个Bug就是它不支持min-width属性。min-width确实非常有用，特别是对于100%宽度的可变模板来说，因为他告诉浏览器停止收缩。<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;对于除IE6以外的所有浏览器来说你只需min-width:xpx;例如：<br/><br/>.container &#123;<br/>　　min-width:300px;<br/>&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;要让这些在IE6下起作用的话你要添加额外的努力！你需要创建两个DIV，一个包含着另一个。<br/><br/>&lt;div class=”container”&gt;<br/>&lt;div class=”holder”&gt;Content&lt;/div&gt;<br/>&lt;/div&gt;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;然后你需要设置外面层的min-width：<br/><br/>.container &#123;<br/>　　min-width:300px;<br/>&#125;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;现在又要IE hack起作用了，你需要写下以下代码：<br/><br/>* html .container &#123;<br/>　　border-right: 300px solid #FFF;<br/>&#125;<br/>* html .holder &#123;<br/>　　display: inline-block;<br/>　　position: relative;<br/>　　margin-right: -300px;<br/>&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;当浏览器窗口调整外层宽度来适应直到它缩小到border的宽度时，这个时候它就不能够在缩小了。而holder层也会停止收缩。外层的边框宽度变成了内层的最小宽度。<br/><br/><strong>&nbsp;&nbsp;&nbsp;&nbsp;9、隐藏水平滚动</strong><br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;要去除水平滚动条，可以在body中插入overflow-x:hidden属性。<br/><br/>body &#123;<br/>　　overflow-x: hidden;<br/>&#125;<br/> <br/>&nbsp;&nbsp;&nbsp;&nbsp;这在你决意要用一个比浏览器款的图片或Flash时很有用。 <br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css%25E6%25BB%25A4%25E9%2595%259C/" rel="tag">css滤镜</a> , <a href="http://www.azuresky.com.cn/go.php/tags/code/" rel="tag">code</a> , <a href="http://www.azuresky.com.cn/go.php/tags/%25E8%25A7%25A3%25E5%2586%25B3%25E6%2596%25B9%25E6%25A1%2588/" rel="tag">解决方案</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-CSSAbbreviationsSummary.php</link>
<title><![CDATA[较常用的CSS层叠样式表缩写总汇]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Fri, 13 Jun 2008 12:42:34 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-CSSAbbreviationsSummary.php</guid> 
<description>
<![CDATA[ 
	善用CSS层叠样式表缩写可以有效地把CSS文件的大小减小。<br/><br/>CSS缩写的主要规则如下：<br/><br/><strong>颜色(color)</strong><br/>16进制的色彩值，如果每两位的值相同，可以缩写一半，例如：<br/>#000000可以缩写为#000;#336699可以缩写为#369;<br/><br/><strong>容器填充(padding)与边距(margin)</strong><br/>通常有下面四种书写方法:<br/><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;property:value1; </span>表示所有边都是一个值value1；<br/><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;property:value1 value2; </span>表示top和bottom的值是value1,right和left的值是value2<br/><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;property:value1 value2 value3;</span> 表示top的值是value1，right和left的值是value2，bottom的值是value3<br/><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;property:value1 value2 value3 value4; </span>四个值依次表示top,right,bottom,left<br/><br/>方便的记忆方法是顺时针，上右下左。具体应用在margin和padding的例子如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">margin:5px;<br/>margin:5px 6px;<br/>margin:5px 6px 4px;<br/>margin:5px 6px 4px 6px;</div></div><br/><br/><strong>边框(border)</strong><br/>边框的属性如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">&nbsp;&nbsp;&nbsp;&nbsp;border-width:1px;<br/>&nbsp;&nbsp;&nbsp;&nbsp;border-style:solid;<br/>&nbsp;&nbsp;&nbsp;&nbsp;border-color:#000;</div></div><br/><br/>可以缩写为一句：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">border:1px solid #000;</div></div><br/>语法是<span style="font-size: 14px;">border:width style color;</span><br/><br/><strong>背景(backgrounds)</strong><br/>背景的属性如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">&nbsp;&nbsp;&nbsp;&nbsp;background-color:#f00;<br/>&nbsp;&nbsp;&nbsp;&nbsp;background-image:url(background.gif);<br/>&nbsp;&nbsp;&nbsp;&nbsp;background-repeat:no-repeat;<br/>&nbsp;&nbsp;&nbsp;&nbsp;background-attachment:fixed;<br/>&nbsp;&nbsp;&nbsp;&nbsp;background-position:0 0;</div></div><br/><br/>可以缩写为一句：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">background:#f00 url(background.gif) no-repeat fixed 0 0;</div></div><br/>语法是<span style="font-size: 14px;">background:color image repeat attachment position;</span><br/><br/>你可以省略其中一个或多个属性值，如果省略，该属性值将用浏览器默认值，默认值为：<br/><span style="font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;color: transparent<br/>&nbsp;&nbsp;&nbsp;&nbsp;image: none<br/>&nbsp;&nbsp;&nbsp;&nbsp;repeat: repeat<br/>&nbsp;&nbsp;&nbsp;&nbsp;attachment: scroll<br/>&nbsp;&nbsp;&nbsp;&nbsp;position: 0% 0%</span><br/><br/><strong>字体(fonts)</strong><br/>字体的属性如下：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">&nbsp;&nbsp;&nbsp;&nbsp;font-style:italic;<br/>&nbsp;&nbsp;&nbsp;&nbsp;font-variant:small-caps;<br/>&nbsp;&nbsp;&nbsp;&nbsp;font-weight:bold;<br/>&nbsp;&nbsp;&nbsp;&nbsp;font-size:1em;<br/>&nbsp;&nbsp;&nbsp;&nbsp;line-height:140%;<br/>&nbsp;&nbsp;&nbsp;&nbsp;font-family:"Lucida Grande",sans-serif;</div></div><br/><br/>可以缩写为一句：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">font:italic small-caps bold 1em/140% "Lucida Grande",sans-serif;</div></div><br/>注意，如果你缩写字体定义，至少要定义font-size和font-family两个值。<br/><br/><strong>列表(lists)</strong><br/>取消默认的圆点和序号可以这样写list-style:none;<br/>list的属性如下:<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">&nbsp;&nbsp;&nbsp;&nbsp;list-style-type:square;<br/>&nbsp;&nbsp;&nbsp;&nbsp;list-style-position:inside;<br/>&nbsp;&nbsp;&nbsp;&nbsp;list-style-image:url(image.gif);<br/></div></div><br/>可以缩写为一句：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">list-style:square inside url(image.gif);</div></div><br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/code/" rel="tag">code</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css%25E7%25BC%25A9%25E5%2586%2599/" rel="tag">css缩写</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-MozillaCSSWritingTheOrderProposed.php</link>
<title><![CDATA[Mozilla给网站制作朋友们的CSS书写顺序建议]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Fri, 13 Jun 2008 12:22:30 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-MozillaCSSWritingTheOrderProposed.php</guid> 
<description>
<![CDATA[ 
	css显示样式定义属性<br/>display<br/>list-style<br/>position<br/>float<br/>clear<br/><br/>css容器、块等自身样式定义属性<br/>width<br/>height<br/>margin<br/>padding<br/>border<br/>background<br/><br/>css文本样式定义属性<br/>color<br/>font<br/>text-decoration<br/>text-align<br/>vertical-align<br/>white-space<br/>other text<br/>content<br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/xhtml/" rel="tag">xhtml</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/mozilla/" rel="tag">mozilla</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-ReplacementStyle.php</link>
<title><![CDATA[XHTML+CSS布局可调用JS实现实时样式风格替换]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Fri, 28 Dec 2007 14:08:24 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-ReplacementStyle.php</guid> 
<description>
<![CDATA[ 
	如果大家常常泡论坛的话，估计也知道现在这些论坛（不论是 Discuz!或者是PHPWind等等）都支持在论坛底部有一个选择风格的列表菜单链接！<br/>如果你的网站页面是以层叠样式表来定义网页的样式风格的话<br/>又制作了多个层叠样式表（css）就可以用以下的方法来增加你的网站的风格可选性<br/>这样的话浏览者就可以根据自己心情来更换论坛的风格！<br/>下面就是要教大家怎样实现这样的功能！一共有四步。<br/><br/><strong>首先</strong>是JavaScript文件：<br/><span style="font-size: 14px;">replaceStyle.js</span><br/><div class="code">function setActiveStyleSheet(title) &#123; <br/>&nbsp;&nbsp;var i, a, main; <br/>&nbsp;&nbsp;for(i=0; (a = document.getElementsByTagName(&quot;link&quot;)&#91;i&#93;); i++) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;if(a.getAttribute(&quot;rel&quot;).indexOf(&quot;style&quot;) != -1 &amp;&amp; a.getAttribute(&quot;title&quot;)) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.disabled = true; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(a.getAttribute(&quot;title&quot;) == title) a.disabled = false; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125; <br/>&#125; <br/><br/>function getActiveStyleSheet() &#123; <br/>&nbsp;&nbsp;var i, a; <br/>&nbsp;&nbsp;for(i=0; (a = document.getElementsByTagName(&quot;link&quot;)&#91;i&#93;); i++) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;if(a.getAttribute(&quot;rel&quot;).indexOf(&quot;style&quot;) != -1 &amp;&amp; a.getAttribute(&quot;title&quot;) &amp;&amp; !a.disabled) return a.getAttribute(&quot;title&quot;); <br/>&nbsp;&nbsp;&#125; <br/>&nbsp;&nbsp;return null; <br/>&#125; <br/><br/>function getPreferredStyleSheet() &#123; <br/>&nbsp;&nbsp;var i, a; <br/>&nbsp;&nbsp;for(i=0; (a = document.getElementsByTagName(&quot;link&quot;)&#91;i&#93;); i++) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;if(a.getAttribute(&quot;rel&quot;).indexOf(&quot;style&quot;) != -1 <br/>&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; a.getAttribute(&quot;rel&quot;).indexOf(&quot;alt&quot;) == -1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&amp;&amp; a.getAttribute(&quot;title&quot;) <br/>&nbsp;&nbsp;&nbsp;&nbsp;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;return a.getAttribute(&quot;title&quot;); <br/>&nbsp;&nbsp;&#125; <br/>&nbsp;&nbsp;return null; <br/>&#125; <br/><br/>function createCookie(name,value,days) &#123; <br/>&nbsp;&nbsp;if (days) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;var date = new Date(); <br/>&nbsp;&nbsp;&nbsp;&nbsp;date.setTime(date.getTime()+(days*24*60*60*1000)); <br/>&nbsp;&nbsp;&nbsp;&nbsp;var expires = &quot;; expires=&quot;+date.toGMTString(); <br/>&nbsp;&nbsp;&#125; <br/>&nbsp;&nbsp;else expires = &quot;&quot;; <br/>&nbsp;&nbsp;document.cookie = name+&quot;=&quot;+value+expires+&quot;; path=/&quot;; <br/>&#125; <br/><br/>function readCookie(name) &#123; <br/>&nbsp;&nbsp;var nameEQ = name + &quot;=&quot;; <br/>&nbsp;&nbsp;var ca = document.cookie.split(&#039;;&#039;); <br/>&nbsp;&nbsp;for(var i=0;i &lt; ca.length;i++) &#123; <br/>&nbsp;&nbsp;&nbsp;&nbsp;var c = ca&#91;i&#93;; <br/>&nbsp;&nbsp;&nbsp;&nbsp;while (c.charAt(0)==&#039; &#039;) c = c.substring(1,c.length); <br/>&nbsp;&nbsp;&nbsp;&nbsp;if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); <br/>&nbsp;&nbsp;&#125; <br/>&nbsp;&nbsp;return null; <br/>&#125; <br/><br/>window.onload = function(e) &#123; <br/>&nbsp;&nbsp;var cookie = readCookie(&quot;style&quot;); <br/>&nbsp;&nbsp;var title = cookie ? cookie : getPreferredStyleSheet(); <br/>&nbsp;&nbsp;setActiveStyleSheet(title); <br/>&#125; <br/><br/>window.onunload = function(e) &#123; <br/>&nbsp;&nbsp;var title = getActiveStyleSheet(); <br/>&nbsp;&nbsp;createCookie(&quot;style&quot;, title, 365); <br/>&#125; <br/><br/>&nbsp;&nbsp;var cookie = readCookie(&quot;style&quot;); <br/>&nbsp;&nbsp;var title = cookie ? cookie : getPreferredStyleSheet(); <br/>&nbsp;&nbsp;setActiveStyleSheet(title); </div><br/><br/><strong>其次</strong>是在网页（head标签中）中调用你已经为你的网页定义好样式风格的CSS文件（假如有3个css）<br/><span style="font-size: 14px;"><br/>style1.css<br/>style2.css<br/>style3.css</span><br/><div class="code"><br/>&lt;link rel=&quot;stylesheet&quot; rev=&quot;stylesheet&quot; href=&quot;style1.css&quot; type=&quot;text/css&quot; /&gt; &lt;!--第一个样式风格，也是用户打开默认的风格--&gt;<br/>&lt;link rel=&quot;stylesheet&quot; rev=&quot;stylesheet&quot; href=&quot;style2.css&quot; type=&quot;text/css&quot; title=&quot;style2&quot; /&gt; &lt;!--第二个--&gt;<br/>&lt;link rel=&quot;stylesheet&quot; rev=&quot;stylesheet&quot; href=&quot;style3.css&quot; type=&quot;text/css&quot; title=&quot;style3&quot; /&gt; &lt;!--第三个--&gt;<br/></div><br/><br/><strong>再次</strong>是在网页（head标签中）中调用上面写好的Script文件<br/><div class="code"><br/>&lt;script type=&quot;text/javascript&quot; src=&quot;replaceStyle.js&quot;&gt;&lt;/script&gt;<br/></div><br/><br/><strong>最后</strong>让浏览者在页面中实现选择风格（body标签中）<br/><div class="code"><br/>&lt;a href=&quot;#&quot; onclick=&quot;setActiveStyleSheet(&#039;&#039;,1); return false;&quot;&gt;风格1&lt;/a&gt; <br/>&lt;a href=&quot;#&quot; onclick=&quot;setActiveStyleSheet(&#039;style2&#039;,1); return false;&quot;&gt;风格2&lt;/a&gt; <br/>&lt;a href=&quot;#&quot; onclick=&quot;setActiveStyleSheet(&#039;style3&#039;,1); return false;&quot;&gt;风格3&lt;/a&gt;<br/></div><br/><br/><br/>以上就是XHTML+CSS布局可调用JS实现替换样式风格<br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/%25E9%25A3%258E%25E6%25A0%25BC/" rel="tag">风格</a> , <a href="http://www.azuresky.com.cn/go.php/tags/style/" rel="tag">style</a> , <a href="http://www.azuresky.com.cn/go.php/tags/xhtml/" rel="tag">xhtml</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/javascript/" rel="tag">javascript</a>
]]>
</description>
</item><item>
<link>http://www.azuresky.com.cn/post/XhtmlCss-Transparent.php</link>
<title><![CDATA[用CSS控制DIV透明]]></title> 
<author>Tim &lt;tim@azuresky.cn&gt;</author>
<category><![CDATA[Xhtml+Css]]></category>
<pubDate>Thu, 27 Dec 2007 06:28:21 +0000</pubDate> 
<guid>http://www.azuresky.com.cn/post/XhtmlCss-Transparent.php</guid> 
<description>
<![CDATA[ 
	如果要控制DIV透明度，就需要用到CSS的滤镜<br/>其中的Alpha属性就是来实现透明的<br/>甚至可以达到渐变透明效果。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/><strong>用滤镜filter的Alpha属性实现透明。表达格式如下： </strong><br/><div class="code"><br/>filter: alpha(opacity=?，finishopacity=?，style=?，startX=?，startY=?，finishX=?，finishY=?);<br/></div><br/><span style="font-size: 14px;">各项赋值说明：</span><br/>opacity代表透明度，可选值从0到100，0代表完全透明，100代表完全不透明;<br/>finishopacity是一个可选项，用来设置结束时的透明度，从而达到一种渐变效果，它的值也是从0到100;<br/>style参数指定了透明区域的形状特征。其中0代表统一形状；1代表线形；2代表放射状；3代表长方形;<br/>startX和startY代表渐变透明效果的开始坐标，finishX和finishY代表渐变透明效果的结束坐标。<br/></div></div><br/>Tags - <a href="http://www.azuresky.com.cn/go.php/tags/xhtml/" rel="tag">xhtml</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.azuresky.com.cn/go.php/tags/css%25E6%25BB%25A4%25E9%2595%259C/" rel="tag">css滤镜</a> , <a href="http://www.azuresky.com.cn/go.php/tags/div/" rel="tag">div</a>
]]>
</description>
</item>
</channel>
</rss>