<?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>刘钢的博客 - 我是UED &#187; div+css</title>
	<atom:link href="http://www.iamued.com/tag/divcss/feed" rel="self" type="application/rss+xml" />
	<link>http://www.iamued.com</link>
	<description>http://www.IamUED.com</description>
	<lastBuildDate>Wed, 18 Jan 2012 02:51:35 +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>再谈float菜单局中</title>
		<link>http://www.iamued.com/qianduan/825.html</link>
		<comments>http://www.iamued.com/qianduan/825.html#comments</comments>
		<pubDate>Mon, 21 Dec 2009 05:18:10 +0000</pubDate>
		<dc:creator>RichieLiu</dc:creator>
				<category><![CDATA[前端开发]]></category>
		<category><![CDATA[页面实现]]></category>
		<category><![CDATA[div+css]]></category>
		<category><![CDATA[Web标准]]></category>
		<category><![CDATA[前端]]></category>

		<guid isPermaLink="false">http://www.iamued.com/?p=825</guid>
		<description><![CDATA[昨天用ucweb看到了goos发的一篇帖子：谁说Float菜单不可以水平居中，进去看了看，觉得方法有点繁琐了，用到了负边距，position:relativel; 和很少的一点hack。 我这里还有更简单的办法，先展示： 其实我外面应该再套一个div，但为了减少碳排放，舍弃。 DEMO1 DEMO2 其中最为关键的是这一句： 为了照顾较低版本IE，这里使用了条件注释，感觉在IE7以下中，display:inline;的作用就相当于inline-block;。   根据上面代码进化而来的滑动门导航：DEMO演示 其中，这两句有必要说明一下，以免被认为是多余的：   #navigation li a{overflow:hidden;} /* 隐藏掉IE5.5、6多掉的那3px，不是3px bug哈！因为height:30px;line-height:33px; 在IE5.5、6中高度就是33px了。 */ #navigation li a span{cursor:hand;}/* 照顾IE 5.5、6、7鼠标放在span上面不呈手型的bug。此外，IE5.5不支持cursor:pointer;但IE全版本都认识cursor:hand;*/ 完工了，缺点就是，写那一行条件注释，对于有xhtml洁癖的人来说，就像眼里的沙子，想除掉，那就使用hack也无妨！呵呵！ 在safari4，chorme，opera10，ie5.5、5、6、7,ff3中均暂未发现问题。 原文：http://www.blueidea.com/tech/web/2009/7281.asp]]></description>
			<content:encoded><![CDATA[<p>昨天用ucweb看到了goos发的一篇帖子：<a href="http://bbs.blueidea.com/thread-2933719-1-1.html" target="_blank">谁说Float菜单不可以水平居中</a>，进去看了看，觉得方法有点繁琐了，用到了负边距，position:relativel; 和很少的一点hack。</p>
<p>我这里还有更简单的办法，先展示：<br />
其实我外面应该再套一个div，但为了减少碳排放，舍弃。<br />
<a href="http://www.iamued.com/demo/menu-float/menu-float-demo1.html" target="_blank">DEMO1</a> <a href="http://www.iamued.com/demo/menu-float/menu-float-demo2.html" target="_blank">DEMO2</a><br />
<span id="more-825"></span>
<pre class="brush: xml; title: ; notranslate">
&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;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;style type=&quot;text/css&quot;&gt;
body{font-family:Verdana,Arial,sans-serif;font-size:12px;margin:120px auto;text-align:center;}
ul{margin:0;padding:0;list-style:none;}
#navigation{display:inline-block;border:solid 1px red;padding:20px;}
 #navigation li{height:30px;float:left;}
  #navigation li a{float:left;height:30px;line-height:30px;padding:0 23px;background:#97C099;}
  #navigation li a:hover{background:#59c099;color:#fff;}
&lt;/style&gt;
&lt;!--[if lte IE 7]&gt;&lt;style type=&quot;text/css&quot;&gt;#navigation{display:inline;}&lt;/style&gt;&lt;![endif]--&gt;
&lt;title&gt;float菜单局中一法&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul id=&quot;navigation&quot;&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;News&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Store&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Group&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Community&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Help&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p> 其中最为关键的是这一句：
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if lte IE 7]&gt;&lt;style type=&quot;text/css&quot;&gt;#navigation{display:inline;}&lt;/style&gt;&lt;![endif]--&gt;
</pre>
<p> 为了照顾较低版本IE，这里使用了条件注释，感觉在IE7以下中，display:inline;的作用就相当于inline-block;。     根据上面代码进化而来的滑动门导航：<a href="http://www.iamued.com/demo/menu-float/menu-float-demo2.html" target="_blank">DEMO</a>演示
<pre class="brush: xml; title: ; notranslate">
&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;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;style type=&quot;text/css&quot;&gt;
body{font-family:Verdana,Arial,sans-serif;font-size:12px;margin:120px auto;text-align:center;}
ul{margin:0;padding:0;list-style:none;}
#navigation{display:inline-block;padding:20px;border:solid 1px red;}
 #navigation li{height:30px;float:left;}
  #navigation li a{float:left;background:#97C099 url(http://home.blueidea.com/attachment/200903/13/381636_1236958262fsCk.gif) left top no-repeat;padding-left:27px;height:30px;overflow:hidden;}
  #navigation li a span{height:30px;float:left;background:url(http://home.blueidea.com/attachment/200903/13/381636_1236958262fsCk.gif) right -352px no-repeat;padding-right:27px;line-height:33px;cursor:hand;}
  #navigation li a:hover,#navigation li.current a{background-position:left -176px;color:#009;background-color:#8597B5;}
  #navigation li a:hover span,#navigation li.current a span{background-position:right -528px;}
  #navigation li.current a{font-weight:bold;}
&lt;/style&gt;
&lt;!--[if lte IE 7]&gt;&lt;style type=&quot;text/css&quot;&gt;#navigation{display:inline;}&lt;/style&gt;&lt;![endif]--&gt;
&lt;title&gt;根据上面代码升级为滑动门样式&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;ul id=&quot;navigation&quot;&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;News&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li class=&quot;current&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Store&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Group&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Community&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;span&gt;Help&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p> <span>其中，这两句有必要说明一下，以免被认为是多余的：</span>  </p>
<blockquote><p>#navigation li a{overflow:hidden;} /* 隐藏掉IE5.5、6多掉的那3px，不是3px bug哈！因为height:30px;line-height:33px; 在IE5.5、6中高度就是33px了。 */  #navigation li a span{cursor:hand;}/* 照顾IE 5.5、6、7鼠标放在span上面不呈手型的bug。此外，IE5.5不支持cursor:pointer;但IE全版本都认识cursor:hand;*/</p></blockquote>
<p>完工了，缺点就是，写那一行条件注释，对于有xhtml洁癖的人来说，就像眼里的沙子，想除掉，那就使用hack也无妨！呵呵！  在safari4，chorme，opera10，ie5.5、5、6、7,ff3中均暂未发现问题。  原文：<a href="http://www.blueidea.com/tech/web/2009/7281.asp">http://www.blueidea.com/tech/web/2009/7281.asp</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.iamued.com/qianduan/825.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

