<?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>Flex Home &#187; position</title>
	<atom:link href="http://flex.desizen.com/tag/position/feed/" rel="self" type="application/rss+xml" />
	<link>http://flex.desizen.com</link>
	<description>又一个 flex 博客</description>
	<lastBuildDate>Thu, 01 Dec 2011 03:33:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>完美的IE6 position:fixed</title>
		<link>http://flex.desizen.com/ie6-position-fixed/</link>
		<comments>http://flex.desizen.com/ie6-position-fixed/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 06:52:39 +0000</pubDate>
		<dc:creator>joel</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[position]]></category>

		<guid isPermaLink="false">http://flex.joelove.cn/?p=230</guid>
		<description><![CDATA[这个内容是老生常谈了,主要问题就是IE6不支持 position:fixed 引起的BUG.当我们去搜索解决这个bug的垮浏览器解决办法时,绝大多数结果都是说使用 position:absolute 来替代解决,可是我们真的解决了么?没有,因为当页面比较长的时候,拖动滚动条,那个fix的地方也相应的闪动.虽然最终会近似于需求的目标,但是不完美.那么如何解决这一问题呢? 造成这个问题的原因是fixed元素的绝对位置是相对于HTML元素,滚动条是body元素的(貌似ie6中他们的区别就是在于滚动条界限那里). 知道了原因,我们就大概知道如何解决了: &#60;!--[if IE 6]&#62; &#60;style type=&#34;text/css&#34;&#62; html{overflow:hidden;} body{height:100%;overflow:auto;} #fixed {position:absolute;} &#60;/style&#62; &#60;!--[endif]--&#62; 没错,就是加上这样的一段code,现在看看完整的页面code: &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62; &#60;title&#62;IE6 position:fixed&#60;/title&#62; &#60;style&#62; * { padding:0; margin:0; } &#160; #fixed { background-color:#ddd; border:1px solid #aaa; position:fixed; right:0; top:0; } &#60;/style&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>这个内容是老生常谈了,主要问题就是IE6不支持 position:fixed 引起的BUG.当我们去搜索解决这个bug的垮浏览器解决办法时,绝大多数结果都是说使用 position:absolute 来替代解决,可是我们真的解决了么?没有,因为当页面比较长的时候,拖动滚动条,那个fix的地方也相应的闪动.虽然最终会近似于需求的目标,但是不完美.那么如何解决这一问题呢?<span id="more-230"></span></p>
<p>造成这个问题的原因是<strong>fixed元素的绝对位置是相对于HTML元素,滚动条是body元素的</strong>(貌似ie6中他们的区别就是在于滚动条界限那里).<br />
知道了原因,我们就大概知道如何解决了:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!--[if IE 6]&gt;
&lt;style type=&quot;text/css&quot;&gt;
	html{overflow:hidden;}
	body{height:100%;overflow:auto;}
	#fixed {position:absolute;}
&lt;/style&gt;
&lt;!--[endif]--&gt;</pre></div></div>

<p>没错,就是加上这样的一段code,现在看看完整的页面code:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #00bbdd;">&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;</span>
<span style="color: #000000;">&lt;html xmlns=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;head<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;meta http-equiv=<span style="color: #ff0000;">&quot;Content-Type&quot;</span> content=<span style="color: #ff0000;">&quot;text/html; charset=utf-8&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;">&lt;title<span style="color: #7400FF;">&gt;</span></span>IE6 position:fixed<span style="color: #000000;">&lt;/title<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;style<span style="color: #7400FF;">&gt;</span></span>
* {
	padding:0;
	margin:0;
}
&nbsp;
#fixed {
	background-color:#ddd;
	border:1px solid #aaa;
	position:fixed;
	right:0;
	top:0;
}
<span style="color: #000000;">&lt;/style<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!--[if IE 6]&gt;</span></span>
<span style="color: #000000;">&lt;style type=<span style="color: #ff0000;">&quot;text/css&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	html{overflow:hidden;}
	body{height:100%;overflow:auto;}
	#fixed{position:absolute;right:17px;}
<span style="color: #000000;">&lt;/style<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!--[endif]--&gt;</span></span>
<span style="color: #000000;">&lt;/head<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;body<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;div style=<span style="color: #ff0000;">&quot;height:2000px&quot;</span><span style="color: #7400FF;">&gt;</span>&lt;/div<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;div id=<span style="color: #ff0000;">&quot;fixed&quot;</span><span style="color: #7400FF;">&gt;</span></span>
  FIXED
<span style="color: #000000;">&lt;/div<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;/body<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;">&lt;/html<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>from: <a href="http://dancewithnet.com/2007/04/19/cross-brower-css-fixed-position/" target="_blank">随网之舞</a></p>
]]></content:encoded>
			<wfw:commentRss>http://flex.desizen.com/ie6-position-fixed/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
	</channel>
</rss>

