<?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>Prower&#039;s Blog &#187; 定位属性</title>
	<atom:link href="http://www.prower.cn/tag/%e5%ae%9a%e4%bd%8d%e5%b1%9e%e6%80%a7/feed" rel="self" type="application/rss+xml" />
	<link>http://www.prower.cn</link>
	<description>关注互联网、体验互联网，记录成长历程</description>
	<lastBuildDate>Thu, 05 Jan 2012 00:40:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>两侧背景自动延伸的CSS实现方法</title>
		<link>http://www.prower.cn/technic/1778</link>
		<comments>http://www.prower.cn/technic/1778#comments</comments>
		<pubDate>Mon, 22 Feb 2010 03:29:45 +0000</pubDate>
		<dc:creator>摄氏度</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css技巧]]></category>
		<category><![CDATA[定位属性]]></category>

		<guid isPermaLink="false">http://www.prower.cn/?p=1778</guid>
		<description><![CDATA[方法来源于土豆网的导航，在这里纪录一下实现的思路。 主要是利用 position 属性的 absolute 和 relative 配合 z-index 来实现的，通过position:absolute将需要平铺的背景层叠在另一背景上，这样即可以实现同一位置的两个背景，再使用z-index将内容提升到最高阶显示。 &#60;div id=”a”&#62; &#60;div id=”b”&#62; &#60;ul&#62; &#60;li&#62;&#60;a href=”http://www.prower.cn/category/internet”&#62;互联网谈&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=”http://www.prower.cn/category/interaction”&#62;交互设计&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=”http://www.prower.cn/category/technic”&#62;技术言论&#60;/a&#62;&#60;/li&#62; &#60;/ul&#62; &#60;div id=”c”&#62;&#60;/div&#62; &#60;/div&#62; &#60;div id=”d”&#62;&#60;/div&#62; &#60;/div&#62; 首先将其中一个背景样式写在&#60;div id=”a”&#62;上，然后是将另一个背景样式写在&#60;div id=”d”&#62;上，&#60;div id=”b”&#62;为内容层，&#60;div id=”c”&#62;是另一个背景样式层，可以自由的出现在&#60;div id=”b”&#62;里面的任何一个位置。如土豆网中间的那个有弧线的背景。 然后是样式方面： #a {background:#f00; height:50px; position:relative; width:100%;} #b {height:50px; margin:0 auto; position:relative; width:950px; z-index:9000;} #c {background:#ff0; height:50px; position:absolute; left:100px; top:0; width:100px; z-index:-1;} #d [...]]]></description>
			<content:encoded><![CDATA[<p>方法来源于土豆网的导航，在这里纪录一下实现的思路。</p>
<p>主要是利用 <strong>position </strong>属性的 <strong>absolute </strong>和 <strong>relative</strong> 配合 <strong>z-index</strong> 来实现的，通过position:absolute将需要平铺的背景层叠在另一背景上，这样即可以实现同一位置的两个背景，再使用z-index将内容提升到最高阶显示。</p>
<blockquote><p>&lt;div id=”a”&gt;<br />
&lt;div id=”b”&gt;<br />
&lt;ul&gt;<br />
&lt;li&gt;&lt;a href=”http://www.prower.cn/category/internet”&gt;互联网谈&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=”http://www.prower.cn/category/interaction”&gt;交互设计&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href=”http://www.prower.cn/category/technic”&gt;技术言论&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
&lt;div id=”c”&gt;&lt;/div&gt;<br />
&lt;/div&gt;<br />
&lt;div id=”d”&gt;&lt;/div&gt;<br />
&lt;/div&gt;</p></blockquote>
<p><span id="more-1778"></span></p>
<p>首先将其中一个背景样式写在&lt;div id=”a”&gt;上，然后是将另一个背景样式写在&lt;div id=”d”&gt;上，&lt;div id=”b”&gt;为内容层，&lt;div id=”c”&gt;是另一个背景样式层，可以自由的出现在&lt;div id=”b”&gt;里面的任何一个位置。如土豆网中间的那个有弧线的背景。</p>
<p>然后是样式方面：</p>
<blockquote><p>#a {background:#f00; height:50px; position:relative; width:100%;}<br />
#b {height:50px; margin:0 auto; position:relative; width:950px; z-index:9000;}<br />
#c {background:#ff0; height:50px; position:absolute; left:100px; top:0; width:100px; z-index:-1;}<br />
#d {background:#f60; height:50px; position:absolute; left:0; top:0; width:50%; z-index:1;}<br />
ul {line-height:50px; position:relative; z-index:9001;}</p></blockquote>
<p>具体代码参见：<a href="http://www.prower.cn/page/menu.html" target="_blank">两侧背景自动延伸的CSS实现方法</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.prower.cn/technic/1778/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

