<?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>出家如初，成佛有余&#187; overflow</title>
	<atom:link href="http://www.yeeach.com/tag/overflow/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yeeach.com</link>
	<description>专注电子商务领域，关注无线互联网，关注新媒体；Yeeach.com用于记录我技术生涯的点滴</description>
	<lastBuildDate>Sun, 25 Jul 2010 10:30:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>FIREFOX / IE Word-Wrap:Word-Break问题</title>
		<link>http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/</link>
		<comments>http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 17:29:00 +0000</pubDate>
		<dc:creator>chuan liang</dc:creator>
				<category><![CDATA[技术相关]]></category>
		<category><![CDATA[break-word]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[overflow]]></category>
		<category><![CDATA[word-wrap]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/</guid>
		<description><![CDATA[用的是wpzone.net的fresh wordpress主题，很烦人的是在Internet Explorer下如果content或sidebar的内容部分一行的内容过长，则经常出现sidebar被挤到页面最下端的情况，而在firefox下没有此种现象。一般出现在如下几种情况： 图片太大超过了width url太长没有正常换行，超过了width 代码太长没有正常换行，超过了width 究其原因是因为对于无空格连续长字符，IE与Firefox将它看成是一个长单词了，因此不会自动换行。 对于IE，可以通过IE专有的CSS属性word-wrap即可实现自动换行：word-wrap:break-word; 对于Firefox，CSS2标准并没有定义类似word-wrap的属性，可以通过overflow属性将撑出的部分隐藏：overflow:hidden 因此为了兼容性，可以使用如下方法： word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } [...]]]></description>
			<content:encoded><![CDATA[<p>  用的是<a href="http://wpzone.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://wpzone.net/');" title="http://wpzone.net/">wpzone.net</a>的<a href="http://wpzone.net/free-wordpress-themes/fresh/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://wpzone.net/free-wordpress-themes/fresh/');">fresh</a> wordpress主题，很烦人的是在Internet Explorer下如果content或sidebar的内容部分一行的内容过长，则经常出现sidebar被挤到页面最下端的情况，而在firefox下没有此种现象。一般出现在如下几种情况：</p>
<ul>
<li>图片太大超过了width</li>
<li>url太长没有正常换行，超过了width</li>
<li>代码太长没有正常换行，超过了width</li>
</ul>
<p>究其原因是因为对于无空格连续长字符，IE与Firefox将它看成是一个长单词了，因此不会自动换行。</p>
<p>对于IE，可以通过IE专有的CSS属性word-wrap即可实现自动换行：word-wrap:break-word;</p>
<p>对于Firefox，CSS2标准并没有定义类似word-wrap的属性，可以通过overflow属性将撑出的部分隐藏：overflow:hidden</p>
<p>因此为了兼容性，可以使用如下方法：</p>
<pre class="csharpcode">word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */</pre>
<style type="text/css">.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } </style>
<p>修改fresh theme的style.css文件，在#content和#sidebar中增加上述属性以及pre属性</p>
<pre class="csharpcode">#content {
color:#000;
display:inline;
float:left;
font-size:14px;
line-height:1.5em;
text-align:left;
width:635px;
margin:13px 0 0 20px;
padding:0 0 20px 0px;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}

#sidebar {
display:inline;
background-color:#fff;
float:right;
font-size:12px;
width:230px;
line-height:1.4em;
padding:20px 20px;
margin:15px 20px 15px 0;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}</pre>
<pre class="csharpcode">pre {
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;       /* Internet Explorer 5.5+ */
}</pre>
<pre class="csharpcode"></pre>
<p>另外对于firefox和opera可以采用javascript方式来避免overflow:hidden的弊端，具体实现可以参考：</p>
<p><a href="http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html');">Script word-wrap to Firefox &#8211; updated version</a></p>
<style type="text/css">.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } </style>
<style type="text/css">.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } </style>
<h3>参考文档：</h3>
<p><a href="http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html');" title="http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html">http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html</a></p>
<p><a href="http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html');" title="http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html">http://elmicoxcodes.blogspot.com/2007/06/script-word-wrap-to-firefox-updated.html</a></p>
<p><a href="http://jiarry.bokee.com/5871385.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://jiarry.bokee.com/5871385.html');" title="http://jiarry.bokee.com/5871385.html">http://jiarry.bokee.com/5871385.html</a></p>
<p><a href="http://bbs.blueidea.com/thread-2692909-1-1.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://bbs.blueidea.com/thread-2692909-1-1.html');" title="http://bbs.blueidea.com/thread-2692909-1-1.html">http://bbs.blueidea.com/thread-2692909-1-1.html</a></p>
<p><a href="http://www.positioniseverything.net/explorer/expandingboxbug.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.positioniseverything.net/explorer/expandingboxbug.html');" title="http://www.positioniseverything.net/explorer/expandingboxbug.html">http://www.positioniseverything.net/explorer/expandingboxbug.html</a></p>
<p class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:69da351d-3c77-4276-b38b-db060a301679" style="margin: 0px; padding: 0px; display: inline; float: none">Technorati 标签:<a href="http://technorati.com/tags/wordpress/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://technorati.com/tags/wordpress/');" rel="tag">wordpress</a>,<a href="http://technorati.com/tags/css/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://technorati.com/tags/css/');" rel="tag">css</a>,<a href="http://technorati.com/tags/overflow/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://technorati.com/tags/overflow/');" rel="tag">overflow</a>,<a href="http://technorati.com/tags/word-wrap/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://technorati.com/tags/word-wrap/');" rel="tag">word-wrap</a>,<a href="http://technorati.com/tags/break-word/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://technorati.com/tags/break-word/');" rel="tag">break-word</a></p>
	<p></p>
	<hr noshade style="margin:0;height:1px" />
	<p>&copy; chuan liang for <a href="http://www.yeeach.com" >出家如初，成佛有余</a>, 2007. |
	  <a href="http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/" >Permalink</a> |
	  <a href="http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/#comments" >One comment</a></p>
	<p>Add to <a href="http://del.icio.us/post?url=http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/&amp;title=FIREFOX / IE Word-Wrap:Word-Break问题" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://del.icio.us/post?url=http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/&amp;title=FIREFOX / IE Word-Wrap:Word-Break问题');">del.icio.us</a></p>
	<p>Search blogs linking this post with <a href="http://www.technorati.com/search/http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://www.technorati.com/search/http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/');" title="Search on Technorati">Technorati</a></p>
	<p>Want more on these topics ? Browse the archive of posts filed under <a href="http://www.yeeach.com/category/%e6%8a%80%e6%9c%af-%e8%bd%af%e4%bb%b6/"  title="查看 技术相关 的全部文章" rel="category tag">技术相关</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yeeach.com/2007/10/23/firefox-ie-word-wrapword-break%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
