<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>不一样的蚊子 &#187; WEB规范</title>
	<atom:link href="http://adamghost.com/category/technique/web-standards/feed/" rel="self" type="application/rss+xml" />
	<link>http://adamghost.com</link>
	<description>交互设计师——专注用户体验。</description>
	<lastBuildDate>Tue, 10 Aug 2010 07:55:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Safari/Chorme/Webkit-based Browsers CSS hack redux</title>
		<link>http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/</link>
		<comments>http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 01:21:52 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[Xhtml CSS]]></category>

		<guid isPermaLink="false">http://adamghost.com/?p=453</guid>
		<description><![CDATA[Safari CSS Hack写法。
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari 3.0 and Chrome rules here */
}]]></description>
			<content:encoded><![CDATA[<p>In March 2007, I wrote about a <a href="http://themechanism.com/blog/2007/03/28/safari-css-hack/">Safari <abbr title="Cascading Style Sheets">CSS</abbr> hack</a> called the &#8220;Pound Safari Post Semicolon&#8221; hack (coined by Tony at <a rel="external" href="http://www.simiandesign.com/blog-fu/2005/11/safari_css_hack.php">Simian Design</a>). As of Safari 3.0, this hack no longer works. However, there <em>is</em> a way to target Safari 3.0:</p>
<blockquote><p>@media screen and (-webkit-min-device-pixel-ratio:0) {<br />
/* Safari 3.0 and Chrome rules here */<br />
}</p></blockquote>
<p>As always, the disclaimer: nobody condones the use of hacks, but we all (well, most of us) have to make use of them at least once in a while. The above code targets both Safari 3.0 and Google&#8217;s Chrome. Hopefully, it will be a future-proof hack, since the -webkit part of the selector will probably not be adopted by other browsers.</p>
<p>Example: The following code set the background color of the &lt;body&gt; element red in all browsers and then resets it to blue in Safari 3.0 and Chrome.<br />
<code>body { background-color: red; }<br />
@media screen and (-webkit-min-device-pixel-ratio:0) {<br />
body { background-color: blue; }<br />
}</code><br />
[<a href="http://adamghost.com/wp-content/sample/safari-css-hack-redux/safari-css-hack.html">demo</a>]</p>
<p><em>Tested on Mac OS X version 10.5.1 with Safari version 3.0.4 (5523.10.6) and Mozilla Firefox version 2.0.0.11. Tested on Windows XP Professional Version 2002 SP 2 with Mozilla Firefox version 2.0.0.11, Opera 9.10, and Microsoft Internet Explorer 6. Hack from <a rel="external" href="http://www.evotech.net/blog/2007/06/targeting-safari-30-with-css/">CSS, JavaScript and XHTML Explained</a>.</em></p>
<p><strong>Update 2008-11-26:</strong> Since this hack targets Webkit-based browsers, Chrome is also affected. At the original time of writing, it also affected Opera (9.10); it hasn&#8217;t since 9.50. The post copy has been updated to reflect these developments.</p>
<p>This article comes from :<a title="Permanent Link to Safari CSS hack redux" rel="bookmark" href="http://themechanism.com/blog/2008/01/08/safari-css-hack-redux/">Safari CSS hack redux</a> <a href="http://themechanism.com/blog/2008/01/08/safari-css-hack-redux/" target="_blank">http://themechanism.com/blog/2008/01/08/safari-css-hack-redux/</a><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/" rel="bookmark" title="21/12/2008">flash 在浏览器中大小</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
</ul>
<p><!-- Similar Posts took 8.991 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Having “layout”</title>
		<link>http://adamghost.com/2009/03/ie-has-layout-and-bugs/</link>
		<comments>http://adamghost.com/2009/03/ie-has-layout-and-bugs/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 17:10:21 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[haslayout]]></category>
		<category><![CDATA[Xhtml CSS]]></category>

		<guid isPermaLink="false">http://adamghost.com/?p=363</guid>
		<description><![CDATA[Having “layout”
We all know that browsers can be buggy, and IE on Windows seems buggier than most. One of the reasons IE/Win behaves differently from other browsers is because the rendering engine uses an internal concept called “layout.” Because layout is a concept particular to the internal working of the rendering engine, it is not [...]]]></description>
			<content:encoded><![CDATA[<h2>Having “layout”</h2>
<p>We all know that browsers can be buggy, and IE on Windows seems buggier than most. One of the reasons IE/Win behaves differently from other browsers is because the rendering engine uses an internal concept called “layout.” Because layout is a concept particular to the internal working of the rendering engine, it is not something you would normally need to know about. However, layout problems are the root of many IE/Win rendering bugs, so it is useful to understand the concept and how it affects your CSS.</p>
<h3>What is “layout”?</h3>
<p>Internet Explorer on Windows uses the layout concept to control the size and positioning of elements. Elements that are said to “have layout” are responsible for sizing and positioning themselves and their children. If an element does not “have layout,” its size and position are controlled by the nearest ancestor with layout. The layout concept is a hack used by IE’s rendering engine to reduce its processing overhead. Ideally all elements would be in control of their own size and positioning. However, this causes huge performance problems in IE. As such, the IE/Win development team decided that by applying layout only to those elements that actually needed it, they could reduce the performance overhead substantially.</p>
<p>Elements that have layout by default include</p>
<ul>
<li>body</li>
<li>html in standards mode</li>
<li>table</li>
<li>tr, td</li>
<li>img</li>
<li>hr</li>
<li>input, select, textarea, button</li>
<li>iframe, embed, object, applet</li>
<li>marquee</li>
</ul>
<p>The concept of layout is specific to IE on Windows, and is not a CSS property. Layout cannot be explicitly set in the CSS, although setting certain CSS properties will give an element layout. It is possible to see if an element has layout by using the JavaScript function, hasLayout. This will return true if the element has layout and false if it doesn’t. hasLayout is a read-only property and so cannot be set using JavaScript.</p>
<p>Setting the following CSS properties will automatically give that element layout:</p>
<ul>
<li>position: absolute</li>
<li>float: left or right</li>
<li>display: inline-block</li>
<li>width: any value</li>
<li>height: any value</li>
<li>zoom: any value (Microsoft property—doesn’t validate)</li>
<li>writing-mode: tb-rl (Microsoft property—doesn’t validate)</li>
</ul>
<h3>What effect does layout have?</h3>
<p>Layout is the cause of many IE/Win rendering bugs. For instance, if you have a paragraph of text next to a floated element, the text is supposed to flow around the element. However, in IE 6 and below on Windows, if the paragraph has layout—by setting the height, for example—it is constrained to a rectangular shape, stopping the text from flowing around the float (see Figure below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image2.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="Text float in ie and other browers" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb.png" border="0" alt="Text float in ie and other browers" width="600" height="262" /></a> <strong>Figure Above:</strong> Text is supposed to flow around adjacent floated elements. However, on IE/Win, if the text element has layout, this doesn’t happen.</p>
<p>Another problem revolves around how elements with layout size themselves. If the content of an element becomes larger than the element itself, the content is supposed to flow out of the element. However, in IE 6 and below on Windows, elements with layout incorrectly grow to fit the size of their contents (see Figure below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image3.png"><img style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" title="content flow in ie and other browers" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb1.png" border="0" alt="content flow in ie and other browers" width="600" height="258" /></a></p>
<p><strong>Figure Above:</strong> Elements with layout incorrectly grow to fit their contents.</p>
<p>This means that width in IE/Win actually acts more like a min-width. This behavior is also the cause of many broken floated layouts in IE/Win. When the content of a floated box incorrectly forces the width of the box to grow, the box becomes too big for the available space and drops below the other floated elements.</p>
<p>Other problems include</p>
<ul>
<li>Elements with layout not shrinking to fit</li>
<li>Floats being auto-cleared by layout elements</li>
<li>Relatively positioned elements not gaining layout</li>
<li>Margins not collapsing between elements with layout</li>
<li>The hit area of block-level links without layout only covering the text</li>
</ul>
<p>In the next section, we are going to cover some of the most common browser bugs, and you will notice that many of the fixes for IE on Windows involve setting properties that force the element to have layout. In fact, if you come across an IE/Win bug, one of the first things you can do is try applying rules that force layout to see if that fixes the problem.</p>
<p>If you would like to learn more about IE’s internal hasLayout property, I recommend reading “On Having Layout” at <a href="http://tinyurl.com/acg78">http://tinyurl.com/acg78</a>.</p>
<h3>Common bugs and their fixes</h3>
<p>One of the greatest skills any CSS developer can have is the ability to spot common browsers bugs. By knowing the various elements that conspire to cause these bugs, you can spot and fix them before they ever become a problem.</p>
<h4>Double-margin float bug</h4>
<p>One of the most common and easy-to-spot bugs is the double-margin float bug in IE 6 and below. As the name suggests, this Windows bug doubles the margins on any floated elements (see Figure below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image4.png"><img style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" title="Double-margin float bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb2.png" border="0" alt="Double-margin float bug" width="600" height="238" /></a></p>
<p><strong>Figure Above:</strong> Demonstration of IE/Win’s double-margin float bug</p>
<p>This bug is easily fixed by setting the display property of the element to inline. As the element is floated, setting the display property to inline won’t actually affect the display characteristics. However, it does seem to stop IE 6 and below on Windows from doubling all of the margins. This is such a simple bug to spot and fix: every time you float an element with horizontal margins, you should automatically set the display property to inline.</p>
<h4>Three-pixel text jog bug</h4>
<p>Another very common IE 5-6/Win bug is the 3-pixel text jog bug. This bug manifests itself when you have text adjacent to a floated element. For instance, say you had an element floated left and you don’t want the text in the adjacent paragraph to wrap around the float.</p>
<p>You would do this by applying a left margin to the paragraph, the same width as the image:</p>
<p><code>.myFloat { float: left; width: 200px; }<br />
p { margin-left: 200px; }</code></p>
<p>When you do this, a mysterious 3-pixel gap appears between the text and the floated element. As soon as the floated element stops, the 3-pixel gap disappears (see Figure Below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image5.png"><img style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" title="Three-pixel text jog bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb3.png" border="0" alt="Three-pixel text jog bug" width="600" height="288" /></a></p>
<p><strong>Figure Above:</strong> Demonstration of the IE 5-6/Win’s 3-pixel text jog bug</p>
<p>Fixing this bug requires a two-pronged attack. First, the element containing the text is given an arbitrary height. This forces the element to have layout, which seemingly removes the text jog. Because IE 6 and below on Windows treats height like min-height, setting a tiny height has no effect on the actual dimensions of the element in that browser. However, it will affect other browsers, so the Holly hack is used to hide this rule from everything other than IE 6 and below on Windows:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. */<br />
* html p { height: 1%; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>Unfotunately, doing this causes another problem. As you learned earlier, elements with layout are constrained to a rectangular shape and appear next to floated elements rather than underneath them. The addition of 200 pixels of padding actually creates a 200-pixel gap between the floated element and the paragraph in IE 5-6/Win. To avoid this gap, you need to reset the margin on IE 5-6/Win back to zero:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. */<br />
* html p { height: 1%; margin-left: 0; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>The text jog is fixed, but another 3-pixel gap has now appeared, this time on the floated image. To remove this gap, you need to set a negative 3-pixel right margin on the float:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. */<br />
* html p { height: 1%; margin-left: 0; }<br />
* html .myFloat { margin-right: -3px; }<br />
 /* End hide from IE5/Mac */ </code></p>
<p>This will fix the problem if the floated element is anything other than an image. However, if the floated element is an image, there is one last problem to solve. IE 5.x/Win adds a 3-pixel gap to both the left and the right of the image, whereas IE 6 leaves the image’s margins untouched. As such, another hack is required to remove the 3-pixel gap from IE 5.x/Win only:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. */<br />
* html p { height: 1%; margin-left: 0; }<br />
* html img.myFloat { margin: 0 -3px; margin: 0; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>This solves the problem, but in a really nasty and complicated way. As such, if possible you would be better off splitting these rules up into separate, browser-specific stylesheets. If you did this, you could have one stylesheet for IE 5.x on Windows:</p>
<p><code>p { height: 1%; margin-left: 0; }<br />
img.myFloat { margin: 0 -3px; } </code></p>
<p>And another for IE 6:</p>
<p><code>p { height: 1%; margin-left: 0; }<br />
img.myFloat { margin: 0; } </code></p>
<h4>IE 6 peek-a-boo bug</h4>
<p>Another strange and infuriating bug is IE 6’s peek-a-boo bug, so called because under certain conditions text will seem to disappear, only to reappear when the page is reloaded. This happens when there is a floated element followed by some nonfloated elements and then a clearing element, all contained within a parent element that has a background color or image set. If the clearing element touches the floated element, the nonfloated elements in-between seem to disappear behind the parent element’s background color or image, only to reappear when the page is refreshed (see Figure Below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image6.png"><img style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" title="IE 6 peek-a-boo bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb4.png" border="0" alt="IE 6 peek-a-boo bug" width="600" height="305" /></a></p>
<p><strong>Figure Above:</strong> Demonstration of IE 6’s peek-a-boo bug</p>
<p>Luckily, there are a number of ways you can combat this bug. The easiest way is probably to remove the background color or image on the parent element. However, this is often not practical. Another way is to stop the clearing element from touching the floated element. The bug doesn’t seem to manifest itself if the container element has specific dimensions applied. The bug also doesn’t manifest itself if the container is given a line height. Lastly, setting the position property of the float and the container to relative also seems to alleviate the problem.</p>
<h4>Absolute positioning in a relative container</h4>
<p>The last major browser bug I am going to cover involves absolutely positioned elements within a relatively positioned container. You learned in earlier chapters how useful nesting an absolutely positioned element in a relative container can be. However, IE 6 and below has a number of bugs when you use this technique.</p>
<p>These bugs arise from the fact that relatively positioned elements don’t gain IE/Win’s internal hasLayout property. As such, they don’t create a new positioning context and all of the positioned elements get positioned relative to the viewport instead (see Figure Below).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image7.png"><img style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" title="Absolute positioning in a relative container" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb5.png" border="0" alt="Absolute positioning in a relative container" width="600" height="348" /></a></p>
<p>To get IE 6 and below on Windows to behave correctly, you need to force the relatively positioned container to have layout. One way to do this is to explicitly set a width and height on the container. However, you will often want to use this technique when you don’t know the width and height of the container, or when you want one or both of these properties to be flexible.</p>
<p>Instead, you can use the Holly hack to supply an arbitrary height to the container. This will give the container layout, but because elements in IE 6 and below incorrectly expand to fit their contents, the actual height won’t be affected.</p>
<p><code>/* Hides from IE-Mac */ * html .container { height: 1%; } /* End hide from IE-Mac */ </code></p>
<h3>Stop picking on Internet Explorer</h3>
<p>Internet Explorer isn’t the only buggy browser around, so you may wonder why I have been focusing my attentions on IE bugs. Don’t worry, it’s not another case of Microsoft bashing; there are good reasons for this focus.</p>
<p>First, IE has by far the biggest browser market share. With so many copies in circulation, IE bugs tend to get found and documented pretty quickly. When a major CSS bug gets discovered in IE, scores of developers will be on the case trying to find a fix or a workaround. Because of this popularity, there are more well-documented bugs and fixes for IE than any other browser.</p>
<p>The other major issue is the pace of development. Browsers such as Firefox, Safari, and Opera are constantly being updated, with new builds appearing with remarkable frequency. Almost as soon as a bug is discovered, it is fixed and a new version of the browser released. Because of this, any Firefox or Safari bug I talk about now will probably have been fixed by the next revision.</p>
<p>This pace of development is excellent, but it does have its own problems. Rather than having two or three versions of a browser to deal with, you may have 20 or 30. You can never be sure if your users have the latest version, and this makes testing extremely difficult. IE, on the other hand, didn’t see a major revision for about 5 years. As such, there has been much more time for bugs to surface and much more impetus to find a fix.</p>
<p>Luckily, IE 7 promises to be a much more compliant browser. Many of the better known IE bugs have been addressed, along with increased support for advanced CSS 2.1 selectors such as the child and attribute selectors. As with all browsers, new bugs will surface, and IE 7 will be far from perfect. However, the faster people can be convinced to upgrade to modern browsers such as IE 7 and Firefox, the quicker older browsers such as IE 5.0 can be retired.</p>
<p>In the interim, it is worth exploring Dean Edwards’ excellent IE 7 patch. This series of JavaScript files aims to bring IE 5-6/Win up to speed with IE 7. This includes improved selector implementation and numerous bug fixes. For more information about this patch, visit <a href="http://dean.edwards.name/IE7/">http://dean.edwards.name/IE7/</a>.</p>
<h3>Summary</h3>
<p>In this chapter, you have learned some important techniques for tracking down and squashing CSS bugs. You have learned about IE on Windows internal hasLayout property and how this is the root of many IE/Win browser bugs. Finally, you have learned about some of the most common browser bugs and how to fix them.</p>
<p>Next you will see how all of this information can be put together, through two stunning case studies created by two of the best CSS designers and developers of our time.<br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/" rel="bookmark" title="10/12/2008">IE Haslayout 详解</a></li>
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/" rel="bookmark" title="23/07/2009">Safari/Chorme/Webkit-based Browsers CSS hack redux</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
</ul>
<p><!-- Similar Posts took 10.003 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2009/03/ie-has-layout-and-bugs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>拥有布局 IE haslayout</title>
		<link>http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/</link>
		<comments>http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 17:09:21 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[haslayout]]></category>
		<category><![CDATA[Xhtml CSS]]></category>

		<guid isPermaLink="false">http://adamghost.com/?p=366</guid>
		<description><![CDATA[找们那知道浏览器有bug，而且Windows上的lE的bug 似乎比太多数浏览器都多。IE/Win的衣现与其他浏览器不同的原因之一是，显示引擎使用一个称为布局(layout)的内部概念。因为布均是一个专门针对显示引擎内部工作方式的概念，所以一般悄况下不需要了解它。但是，布局问题是许多IE/Win显示bug的根源，所以理解这个概念以及它如何影响CSS是有捂助的。
什么是布局
Windows 上的IE 使用布局概念来控制元素的尺寸和定位。那些称为拥有布局(have layout)的元素负责本身及其子元素的尺寸和定位。如果一个元旦在没有拥有布局，那么它的尺寸和位置由最近的拥有布局的祖先元素控制。
IE 显示引擎利用布局概念减少它的处理开销。在理想悄况下，所有元素都控制自己的尺寸和定位。但是，这会在IE中导致很大的性能问题。因此，IE/Win 开发团队决定只将布局应用于实际需要它的那些元素，这样就可以充分地减少性能开销。
在默认情况下拥有布局的元素包括:

body
标准模式中的 html
table
tr, td
img
hr
input, select, textarea, button
iframe, embed, object, applet
marquee

布局概念是Windows 上的I E 特有的，而且它不是CS S 属性.尽管某些CSS 属性会使元ffi拥有布局，但是在CSS 巾无法显式地设宣布局.可以使用JavaScript 函数hasLayout 查看一个元亲是否拥有布局.如果元素拥有布局，这个函数就返回true ; 否则返回falseo hasLayout 是一个只读属性，所以无法使用JavaScript 选行设置.
设宜以下CSS 属性会自动地使元亲拥有布局·

position: absolute
float: left or right
display: inline-block
width: any value
height: any value
zoom: any value (Microsoft property—doesn’t validate)
writing-mode: tb-rl (Microsoft property—doesn’t validate)

布局有什么效果?
布局是许多IElWin 显示bug 的根源。例如， 如果一个文本段落靠谷一个浮动元索，那么期望文本围绕这个元索。但是，在Windows 上的1E 6 和更低版本巾，如果段落拥有布局(例如，由于设置了高度).那么它就被限制为矩形，因此阻止文本国绕浮动元素〈见图9-5).

Figure Above: [...]]]></description>
			<content:encoded><![CDATA[<p>找们那知道浏览器有bug，而且Windows上的lE的bug 似乎比太多数浏览器都多。IE/Win的衣现与其他浏览器不同的原因之一是，显示引擎使用一个称为布局(layout)的内部概念。因为布均是一个专门针对显示引擎内部工作方式的概念，所以一般悄况下不需要了解它。但是，布局问题是许多IE/Win显示bug的根源，所以理解这个概念以及它如何影响CSS是有捂助的。</p>
<h3>什么是布局</h3>
<p>Windows 上的IE 使用布局概念来控制元素的尺寸和定位。那些称为拥有布局(have layout)的元素负责本身及其子元素的尺寸和定位。如果一个元旦在没有拥有布局，那么它的尺寸和位置由最近的拥有布局的祖先元素控制。</p>
<p>IE 显示引擎利用布局概念减少它的处理开销。在理想悄况下，所有元素都控制自己的尺寸和定位。但是，这会在IE中导致很大的性能问题。因此，IE/Win 开发团队决定只将布局应用于实际需要它的那些元素，这样就可以充分地减少性能开销。</p>
<p>在默认情况下拥有布局的元素包括:</p>
<ul>
<li>body</li>
<li>标准模式中的 html</li>
<li>table</li>
<li>tr, td</li>
<li>img</li>
<li>hr</li>
<li>input, select, textarea, button</li>
<li>iframe, embed, object, applet</li>
<li>marquee</li>
</ul>
<p>布局概念是Windows 上的I E 特有的，而且它不是CS S 属性.尽管某些CSS 属性会使元ffi拥有布局，但是在CSS 巾无法显式地设宣布局.可以使用JavaScript 函数hasLayout 查看一个元亲是否拥有布局.如果元素拥有布局，这个函数就返回true ; 否则返回falseo hasLayout 是一个只读属性，所以无法使用JavaScript 选行设置.</p>
<p>设宜以下CSS 属性会自动地使元亲拥有布局·</p>
<ul>
<li>position: absolute</li>
<li>float: left or right</li>
<li>display: inline-block</li>
<li>width: any value</li>
<li>height: any value</li>
<li>zoom: any value (Microsoft property—doesn’t validate)</li>
<li>writing-mode: tb-rl (Microsoft property—doesn’t validate)</li>
</ul>
<h3>布局有什么效果?</h3>
<p>布局是许多IElWin 显示bug 的根源。例如， 如果一个文本段落靠谷一个浮动元索，那么期望文本围绕这个元索。但是，在Windows 上的1E 6 和更低版本巾，如果段落拥有布局(例如，由于设置了高度).那么它就被限制为矩形，因此阻止文本国绕浮动元素〈见图9-5).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image2.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="Text float in ie and other browers" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb.png" border="0" alt="Text float in ie and other browers" width="600" height="262" /></a></p>
<p><strong>Figure Above:</strong> 期望文本围绕相邻的浮动元素，但是，在IE/Win上，如果文本元素拥有布局，就不会这样显示。</p>
<p>这会导致浮动布间的各种问题更糟的是，许多人使用IE 作为主浏览器，他们会俯误地认为这才是正确的表现，在其他浏览器以不同方式处理泞-动元素时，他们反而会这必不解.</p>
<p>另-个问题涉及拥有布局的元素如何确定自己的尺，如果元亲的内容变得比元素本身大，那么期望元素流出到元素外.但是，在Windows 上的IE 6 和更低版本中，拥有布局的元素会销误地扩展以便适应内容的尺寸(见圈9-6).</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image3.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="content flow in ie and other browers" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb1.png" border="0" alt="content flow in ie and other browers" width="600" height="258" /></a></p>
<p><strong>Figure Above:</strong> 拥有布局的错误的扩展以便适应内容</p>
<p>这意味IE/Win中的width 实际上更像min-width. 这种行为也是在IE/Win中许多浮动布局被破坏的原因。当浮动框的内容错误地迫使框的宽度增加时，框对于可用空间来说太大了，因此下降到其他浮动元素在下面.</p>
<p>其他问题包括:</p>
<ul>
<li>拥有布局的元素不进行收缩。</li>
<li>布局元亲对浮动进行自动消理。</li>
<li>相对定位的元素不获得布局。</li>
<li>在拥有布局的元素之间空白地不叠加。</li>
<li>在不拥有布局的块级链接上，单击区域只覆盖文本。</li>
</ul>
<p>在下一节中，我们将讨论一些最常见的浏览器bug. 你会注意到对于Windows 上的IE的许多修复方法都涉及通过设置属性迫使元素拥有布局。实际上，如果遇到一个IE/Wi n bug，首先应该做的事情之一就是尝试通过应用规则迫使元崇拥有布局。看看这是否可以修复问题。</p>
<p>如果希忘进一步了解IE的内部hasLayout属性，我建议阅读<a href="http://tinyurl.com/acg78">http://tinyurl.com/acg78</a>上的&#8221;On Having Layout&#8221;。【我的翻译文章在这里<a title="IE Haslayout 详解" href="http://adamghost.com/2008/12/ie-haslayout/" target="_blank">IE Haslayout 详解</a>】</p>
<h3>常见bug及其修复方法</h3>
<p>CSS 开发人员最重要的技能之一是发现常见浏览器bug的能力。通过了解导致这些bug 的各种元索，可以在它们造成问题之前发现并且修复它们。</p>
<h4>双空白边浮动bug</h4>
<p>最常见且最容易发现的bug 之一是IE6和更低版本中的双空白边浮动bug。顾名思义，这个Windows bug使任何浮动元素上的空白边加倍(见图9-7)。</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image4.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="Double-margin float bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb2.png" border="0" alt="Double-margin float bug" width="600" height="238" /></a></p>
<p><strong>Figure Above:</strong> IE/Win 的双空白浮动bug示意阁</p>
<p>这个bug 很容易修复，将元素的display 属性设置为inline 就行了.因为元素是浮动的，将display 属性设置为inline 实际上不会影响显示方式。但是，这似乎会阻止Windows 上的IE6和更低版本将所有空白地加倍。这是一个非常容易发现和修复的bug : 每当对具有水平空白边的元素进行浮动时，都应该很自然地将display 属性设置为inline。</p>
<h4>3像素文本偏移bug</h4>
<p>另一个非常常见的I E 5-61Win bug 是3像素文本偏移bug。当文本与二个浮动元示相邻时，这个bug 就会表现出来。例如，假设将-个元素向左浮动，并且不希望相邻段落中的文本围绕浮动元素。你可能会在段落上应用一个左空白边，其宽度等于浮动元素的宽度:</p>
<p><code>.myFloat { float: left; width: 200px; }<br />
p { margin-left: 200px; }</code></p>
<p>如果这么做，在文本和浮动元素之间就会出现一个莫名其妙的3像素间隙。(见图9-8) 。</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image5.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="Three-pixel text jog bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb3.png" border="0" alt="Three-pixel text jog bug" width="600" height="288" /></a></p>
<p><strong>Figure Above:</strong> IE 5-6/Win 的3像素文本偏移bug示意图</p>
<p>修复这个bug 需要双管齐下。首先，给包含文本的元素设置任意的高度。这会迫使元素拥有布局，这在表面上会消除文本偏移。因为Windows 上的IE6和更低版本将height作为min-height那样对待，所以设置一个小的高度并不会影响元素在这些浏览器巾的实际尺寸。但是，这会影响其他浏览器，所以要使用Holly招数对除了Windows 上的IE6 和更低版本之外的所有其他浏览器隐藏这个规则，</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. \*/<br />
* html p { height: 1%; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>不幸的是，这么做会导致另一个问题。正如在前面学到的，拥有布局的元素被限制为矩形的，并且出现在浮动元索的旁边而不是它们的下面。添加200像素的空白边实际上会在IE 5-6/Win 中在浮动元素和段落之间产生200像素的间隙。为了边免这个问隙，需要将IE 5-6/Win 上的空白边重新设置为零:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. \*/<br />
* html p { height: 1%; margin-left: 0; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>文本偏移被修复了，但是现在另一个3像亲间隙出现了，这一次是在浮动元素上。为了去掉这个问隙，需要在浮动元素上设置一个负值的3像素右空白边：</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. \*/<br />
* html p { height: 1%; margin-left: 0; }<br />
* html .myFloat { margin-right: -3px; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>如果浮动元素是除了图像之外的任何其他东西，那么这个问题己经修复了。但是，如果浮动元旦在是图像，那么还有放后一个问题需要解决。 IE 5.x/Win在图像的左右都添加3像亲的间隙。而IE6不改变图像的空白边。因此，需要用另一个招术在IE 5.x/Win 上去掉3 像素的问隙:</p>
<p><code>/* Hide from IE5-Mac. Only IE-Win sees this. \*/<br />
* html p { height: 1%; margin-left: 0; }<br />
* html img.myFloat { margin: 0 -3px; ma\rgin: 0; }<br />
/* End hide from IE5/Mac */ </code></p>
<p>这会解决问题，但是采用的方式很难看而且太复杂。因此，如果可能的话，最好将这些规则分别放进单独的浏览器特定的样式表中。如果这样做，用于Windows 上的lE 5.x的样式表如下：</p>
<p><code>p { height: 1%; margin-left: 0; }<br />
img.myFloat { margin: 0 -3px; } </code></p>
<p>用于IE 6的样式表如下:</p>
<p><code>p { height: 1%; margin-left: 0; }<br />
img.myFloat { margin: 0; } </code></p>
<h4>IE 6躲躲猫bug</h4>
<p>另一个奇怪而且很烦人的 bug 是IE6 的躲躲猫(peek-a-boo) bug，之所以起这个名称是因为在某些条件下文本看起来消失了，只有在前新装载页面时才再度出现。出现这个bug 的条件是:一个浮动元素后面跟着一些非浮动元素，然后是一个清理元素，所有这些元素都包含在一个设置了背景颜色或阅像的父元束中。如果清理元素碰到了浮动元素，那么中间的作浮动元素看起来消失了，隐藏到了父元素的背景颜色或图像后面，只有在刷新页面时才重新出现(见图9-10)。</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image6.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="IE 6 peek-a-boo bug" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb4.png" border="0" alt="IE 6 peek-a-boo bug" width="600" height="305" /></a></p>
<p><strong>Figure Above:</strong>IE 6的躲躲猫bug示意图</p>
<h4>相对容器中的绝对定位</h4>
<p>我要讨论的段后一个主要浏览器bug涉及相对定位容器中的绝对定位元素。在前面的章节中你学到将绝对定位的元素嵌套在相对容器中是多么有用。但是，IE 6和更低版本在使用这种技术时有许多bug。</p>
<p>这些bug 的原因在于相对定位的元素没有获得IE/Win 的内部hasLayout 属性。因此，它们不创建新的定位上下文，所有绝对定位元素相对于窗口进行定位(见图9-11)。</p>
<p><a href="http://adamghost.com/wp-content/uploads/2009/03/image7.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="Absolute positioning in a relative container" src="http://adamghost.com/wp-content/uploads/2009/03/image-thumb5.png" border="0" alt="Absolute positioning in a relative container" width="600" height="348" /></a></p>
<p><strong>Figure Above:</strong>IE5.x对相对容器中的绝对定位元素的定位方式不正确</p>
<p>为了使Windows 上的IE 6和更低版本的表现正确。需要迫使相对应位的容器拥有布局。一种方法是在容器上显式地设置width 和height。但是，常常希望在不知道容器的width 和height的况下，或者在需要这些属性保持灵活的情况下使用这种技术。</p>
<p>可以使用Holly 招数为容器提供一个的高度。这会让容器拥有布局。但是因为IE 6和更低版本中的元素会不正确地扩展以适应它们的内容，所以设置小的高度不会影响实际高度。</p>
<p><code>/* Hides from IE-Mac \*/<br />
* html .container { height: 1%; }<br />
/* End hide from IE-Mac */ </code></p>
<h3>停止对IE 的批评</h3>
<p>IE 并不足惟一一种有bug 的浏览器，所以你可能会奇怪我为什么只关注IE bug。 不必担心，我找并不是专门和微软过不去，这么做是有理由的。</p>
<p>首先， IE 目前占有最大的浏览器市场份额。因为有许多人在使用IE，IE bug 往往很快被发现而且很好地记录下来。当在IE中发现一个重大的CSS bug时，许多开发人员会尝试寻找修复方法或解决方案。由于IE的流行程度，被记录并修复的IE bug比其他任何浏览器都要多.</p>
<p>另一个主要问题是开发的节奏。Firefox、Safari和Opera等浏器不断地进行更新，新版本以非常高的频率出现。 bug 几乎一经发现就被修复了，并且发布浏览器的新版本.因此，现在讨论的任何Firefox或Safari bug 可能已经被下一个修订版修复了。</p>
<p>如此高的开发节奏确实很棒，但是也有自己的问题。开发人员要应付的浏览器版本不是两三个，而是20或30个。你无法确定用户是否使用最新的版本，这使测试变得极其困难。另一方面，IE差不多5年没有发布主要修订版了。因此，bug 有更多的时间可以暴露出来，开发人员也有更强的寻找修复方法的动力。</p>
<p>幸运的是，IE 7承诺将成为更符合标准的浏览器。许多著名的IE bug 已经被解决，而且对高级CSS 2.1 选择器（比如子选择器和属性选择器）的支持也在增加。与所有浏览器一样，新的bug也会出现，IE 7远不是完美的。但是，人们越快地升级到IE 7和Firefox 等现代浏览器，IE 5.0等老式浏览器就会越快地退役。</p>
<p>在这个过渡时期，可以考虑使用Dean Edwards 的IE 7 补丁。这是一系列JavaScript 文件，它们使IE 5-6/Win 能够接近IE 7的水平.这包括改进的选择器实现和许多bug 修复。关与这个补丁的更多信息，请访问<a href="http://dean.edwards.name/IE7/">http://dean.edwards.name/IE7/</a>。<br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/" rel="bookmark" title="10/12/2008">IE Haslayout 详解</a></li>
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/" rel="bookmark" title="23/07/2009">Safari/Chorme/Webkit-based Browsers CSS hack redux</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
</ul>
<p><!-- Similar Posts took 18.570 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>XHTML CSS Tools collection</title>
		<link>http://adamghost.com/2009/01/xhtml-css-tools-collection/</link>
		<comments>http://adamghost.com/2009/01/xhtml-css-tools-collection/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 16:16:33 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[Xhtml CSS]]></category>

		<guid isPermaLink="false">http://adamghost.com/2009/01/xhtml-css-tools-collection/</guid>
		<description><![CDATA[organize tools of xhtml and css from the web, in order to use it as i like.

css filters (css hacks)，css filters for different browsers 
tests: text-decoration

css filters (css hacks)，css filters for different browsers
HTML demo:css filters (css hacks)
original article:css filters (css hacks)
download source:

tests: text-decoration
HTML demo:tests: text-decoration
original article:RichInStyle.com tests: text-decoration
相关文章:


CSS XHTML 相关资源整合
Safari/Chorme/Webkit-based Browsers CSS hack redux
Having “layout”
拥有布局 [...]]]></description>
			<content:encoded><![CDATA[<p>organize tools of xhtml and css from the web, in order to use it as i like.</p>
<ol>
<li><a href="#css-filter-en">css filters (css hacks)，css filters for different browsers </a></li>
<li><a href="#text-decoration-en">tests: text-decoration</a></li>
</ol>
<h3 id="css-filter-en">css filters (css hacks)，css filters for different browsers</h3>
<p>HTML demo:<a rev="vote" href="http://adamghost.com/wp-content/sample/css-filter/css-filters.html" target="_blank">css filters (css hacks)</a></p>
<p>original article:<a rev="vote-for" href="http://centricle.com/ref/css/filters/" target="_blank">css filters (css hacks)</a></p>
<p><strong>download source:</strong><a class="downloadlink" href="http://adamghost.com/wp-content/plugins/download-monitor/download.php?id=9" title="Version1.0 downloaded 211 times" >css-filters (211)</a></p>
<p><a href="http://adamghost.com/wp-content/sample/css-filter/css-filters.png" target="_blank"><img title="css filter" src="http://adamghost.com/wp-content/uploads/2009/01/image.png" border="0" alt="css filter" width="826" /></a></p>
<h3 id="text-decoration-en">tests: text-decoration</h3>
<p>HTML demo:<a rev="vote" href="http://adamghost.com/wp-content/sample/text-decoration/text-decoration.html" target="_blank">tests: text-decoration</a></p>
<p>original article:<a title="RichInStyle.com tests: text-decoration" rev="vote-for" href="http://www.richinstyle.com/test/text/textdecoration.html" target="_blank">RichInStyle.com tests: text-decoration</a><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/" rel="bookmark" title="23/07/2009">Safari/Chorme/Webkit-based Browsers CSS hack redux</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
<li><a href="http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/" rel="bookmark" title="30/10/2008">(X)HTML Strict 下的嵌套规则</a></li>
</ul>
<p><!-- Similar Posts took 13.280 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2009/01/xhtml-css-tools-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS XHTML 相关资源整合</title>
		<link>http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/</link>
		<comments>http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 16:12:32 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[Xhtml CSS]]></category>

		<guid isPermaLink="false">http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/</guid>
		<description><![CDATA[本文为慢慢整合，日积月累就多了。

css 过滤器，CSS 浏览器兼容表
text-decoration属性详解

css 过滤器，CSS 浏览器兼容表
HTML：css filters (css hacks)
原文：css filters (css hacks)
下载：

text-decoration属性详解
HTML: tests: text-decoration
原文：RichInStyle.com tests: text-decoration
相关文章:


XHTML CSS Tools collection
Safari/Chorme/Webkit-based Browsers CSS hack redux
Having “layout”
拥有布局 IE haslayout
(X)HTML Strict 下的嵌套规则


]]></description>
			<content:encoded><![CDATA[<p>本文为慢慢整合，日积月累就多了。</p>
<ol>
<li><a href="#css-filter">css 过滤器，CSS 浏览器兼容表</a></li>
<li><a href="#text-decoration">text-decoration属性详解</a></li>
</ol>
<h3 id="css-filter">css 过滤器，CSS 浏览器兼容表</h3>
<p>HTML：<a rev="vote" href="http://adamghost.com/wp-content/sample/css-filter/css-filters.html" target="_blank">css filters (css hacks)</a></p>
<p>原文：<a rev="vote-for" href="http://centricle.com/ref/css/filters/" target="_blank">css filters (css hacks)</a></p>
<p>下载：</p>
<p><img title="css filter" src="http://adamghost.com/wp-content/uploads/2009/01/image.png" border="0" alt="css filter" width="826" /></p>
<h3 id="text-decoration">text-decoration属性详解</h3>
<p>HTML: <a rev="vote" href="http://adamghost.com/wp-content/sample/text-decoration/text-decoration.html" target="_blank">tests: text-decoration</a></p>
<p>原文：<a title="RichInStyle.com tests: text-decoration" rev="vote-for" href="http://www.richinstyle.com/test/text/textdecoration.html" target="_blank">RichInStyle.com tests: text-decoration</a><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/" rel="bookmark" title="23/07/2009">Safari/Chorme/Webkit-based Browsers CSS hack redux</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
<li><a href="http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/" rel="bookmark" title="30/10/2008">(X)HTML Strict 下的嵌套规则</a></li>
</ul>
<p><!-- Similar Posts took 8.228 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flash 在浏览器中大小</title>
		<link>http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/</link>
		<comments>http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 00:48:07 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[flash size in browsers]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=142</guid>
		<description><![CDATA[&#60;object width=&#8221;300&#8243; height=&#8221;100&#8243;&#62; &#60;embed width=&#8221;300&#8243; height=&#8221;100&#8243; /&#62; &#60;/object&#62;
ie(lte IE 8)渲染出的大小由object标签中的width以及height确定。
其他浏览器，如firefox, opera, chorme, safari渲染大小由embed确定。
    Technorati : flash size in browsers   Del.icio.us : flash size in browsers   Zooomr : flash size in browsers   Flickr : flash size in browsers 
相关文章:


CSS 框架结构
IE Haslayout 详解
XHTML CSS Tools collection
Safari/Chorme/Webkit-based Browsers CSS [...]]]></description>
			<content:encoded><![CDATA[<p>&lt;object width=&#8221;300&#8243; height=&#8221;100&#8243;&gt; <br/>&lt;embed width=&#8221;300&#8243; height=&#8221;100&#8243; /&gt; <br/>&lt;/object&gt;</p>
<p>ie(lte IE 8)渲染出的大小由object标签中的width以及height确定。</p>
<p>其他浏览器，如firefox, opera, chorme, safari渲染大小由embed确定。</p>
<p xmlns="" class="zoundry_raven_tags">  <!-- Tag links generated by Zoundry Raven. Do not manually edit. http://www.zoundryraven.com -->  <span class="ztags"><span class="ztagspace">Technorati</span> : <a href="http://www.technorati.com/tag/flash+size+in+browsers" class="ztag" rel="tag">flash size in browsers</a></span>  <br/> <span class="ztags"><span class="ztagspace">Del.icio.us</span> : <a href="http://del.icio.us/tag/flash%20size%20in%20browsers" class="ztag" rel="tag">flash size in browsers</a></span>  <br/> <span class="ztags"><span class="ztagspace">Zooomr</span> : <a href="http://www.zooomr.com/search/photos/?q=flash%20size%20in%20browsers" class="ztag" rel="tag">flash size in browsers</a></span>  <br/> <span class="ztags"><span class="ztagspace">Flickr</span> : <a href="http://www.flickr.com/photos/tags/flash%20size%20in%20browsers" class="ztag" rel="tag">flash size in browsers</a></span> </p>
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/css-framework/" rel="bookmark" title="03/12/2008">CSS 框架结构</a></li>
<li><a href="http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/" rel="bookmark" title="10/12/2008">IE Haslayout 详解</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/07/safarichormewebkit-based-browsers-css-hack-redux/" rel="bookmark" title="23/07/2009">Safari/Chorme/Webkit-based Browsers CSS hack redux</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
</ul>
<p><!-- Similar Posts took 7.962 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE Haslayout 详解</title>
		<link>http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/</link>
		<comments>http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 19:21:20 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[haslayout]]></category>
		<category><![CDATA[zoom]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=117</guid>
		<description><![CDATA[IE的haslayout是个很纠结的东西，掌握好CSS就得掌握好它。初学CSS时走了很多弯路，以下几篇文章在我的学习中起了很大的作用，希望能让大家受益。
此文是和老包共同弄的，参考了On have layout 。
另外两篇文章摘自CSS Mastery【精通CSS】，与此文相互补充，希望对大家有帮助

Having “layout”
拥有布局 IE haslayout

拥有layout概述
Internet Explorer 中有很多奇怪的渲染问题可以通过赋予其&#8221;layout&#8221;得到解决。John Gallant 和 Holly Bergevin 把这些问题归类为&#8221;尺寸臭虫(dimensional bugs)&#8221;[32]，意思是这些臭虫可以通过赋予相应元素某个宽度或高度解决。
&#8220;Layout&#8221;是一个 Internet Explorer for Windows的私有概念，它决定了一个元素如何显示以及约束其包含的内容、如何与其他元素交互和建立联系、如何响应和传递应用程序事件、用户事件等。这种渲染特性可以通过某些 CSS 属性被不可逆转地触发。而有些 HTML 元素则默认就具有&#8221;layout&#8221;。
微软的开发者们认为元素都应该可以拥有一个&#8221;属性(property)&#8221;(这是面向对象编程中的一个概念)，于是他们便使用了 hasLayout，这种渲染特性生效时也就是将 hasLayout 设成了 true 之时。了解hasLayout将对IE的臭虫会有更多深入的体会甚至解决方案。
拥有layout的定义
一个元素&#8221;得到 layout&#8221;，或者说一个元素&#8221;拥有 layout&#8221; 的时候，是指它的微软专有属性 hasLayout 为此被设为了 true 。一个&#8221;layout元素&#8221;可以是一个默认就拥有 layout 的元素或者是一个通过设置某些 CSS 属性得到 layout 的元素。
而&#8221;无layout元素&#8221;，是指 hasLayout 未被触发的元素，比如一个未设定宽高尺寸的干净 div 元素就可以做为一个&#8221;无layout祖先&#8221;。
给一个默认没有 layout 的元素赋予 layout 的方法包括设置可触发 hasLayout = true 的 CSS [...]]]></description>
			<content:encoded><![CDATA[<p>IE的haslayout是个很纠结的东西，掌握好CSS就得掌握好它。初学CSS时走了很多弯路，以下几篇文章在我的学习中起了很大的作用，希望能让大家受益。</p>
<p>此文是和<a href="http://www.om19.cn/" target="_blank">老包</a>共同弄的，参考了<a href="http://www.satzansatz.de/cssd/onhavinglayout.html" target="_blank">On have layout</a> 。</p>
<p>另外两篇文章摘自<a href="http://www.douban.com/subject/1583135/" target="_blank">CSS Mastery【精通CSS】</a>，与此文相互补充，希望对大家有帮助</p>
<ul>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/">Having “layout”</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/">拥有布局 IE haslayout</a></li>
</ul>
<h3>拥有layout概述</h3>
<p>Internet Explorer 中有很多奇怪的渲染问题可以通过赋予其&#8221;layout&#8221;得到解决。John Gallant 和 Holly Bergevin 把这些问题归类为&#8221;尺寸臭虫(dimensional bugs)&#8221;[32]，意思是这些臭虫可以通过赋予相应元素某个宽度或高度解决。</p>
<p>&#8220;Layout&#8221;是一个 Internet Explorer for Windows的私有概念，它决定了一个元素如何显示以及约束其包含的内容、如何与其他元素交互和建立联系、如何响应和传递应用程序事件、用户事件等。这种渲染特性可以通过某些 CSS 属性被不可逆转地触发。而有些 HTML 元素则默认就具有&#8221;layout&#8221;。</p>
<p>微软的开发者们认为元素都应该可以拥有一个&#8221;属性(property)&#8221;(这是面向对象编程中的一个概念)，于是他们便使用了 hasLayout，这种渲染特性生效时也就是将 hasLayout 设成了 true 之时。了解hasLayout将对IE的臭虫会有更多深入的体会甚至解决方案。<span id="more-117"></span></p>
<h3>拥有layout的定义</h3>
<p>一个元素&#8221;得到 layout&#8221;，或者说一个元素&#8221;拥有 layout&#8221; 的时候，是指它的微软专有属性 hasLayout 为此被设为了 true 。一个&#8221;layout元素&#8221;可以是一个默认就拥有 layout 的元素或者是一个通过设置某些 CSS 属性得到 layout 的元素。<br />
而&#8221;无layout元素&#8221;，是指 hasLayout 未被触发的元素，比如一个未设定宽高尺寸的干净 div 元素就可以做为一个&#8221;无layout祖先&#8221;。</p>
<p>给一个默认没有 layout 的元素赋予 layout 的方法包括设置可触发 hasLayout = true 的 CSS 属性。参考默认 layout 元素以及这些属性列表。没有办法设置 hasLayout = false ， 除非把一开始那些触发 hasLayout = true 的 CSS 属性去除或重置。</p>
<h3>拥有layout的各种问题</h3>
<p>Layout 在显示盒模型时有着不同寻常而且难以预料的效果，而且有时甚至会牵连到他们的子元素。</p>
<p>一个元素是否具有&#8221;layout&#8221;可能会引发如下的一些问题（包括但不限于）：</p>
<ul>
<li>IE 很多常见的浮动臭虫。</li>
<li>元素本身对一些基本属性的异常处理问题。</li>
<li>容器和其子孙之间的空白边重叠问题。</li>
<li>使用列表时遇到的诸多问题。</li>
<li>背景图像的定位偏差问题。</li>
<li>使用脚本时遇到的浏览器之间处理不一致的问题。</li>
</ul>
<h3>Layout 的由来</h3>
<p>不同于标准属性，也不像某些浏览器的私有 CSS 属性，layout 无法通过某一个 CSS 声明直接设定 。也就是说没有&#8221;layout属性&#8221;这么一个东西，元素要么本身自动拥有 layout，要么借助一些 CSS 声明悄悄地获得 layout。</p>
<p>下列元素应该是默认具有 layout 的：</p>
<ul>
<li>&lt;html&gt;, &lt;body&gt;</li>
<li>&lt;table&gt;, &lt;tr&gt;, &lt;th&gt;, &lt;td&gt;</li>
<li>&lt;img&gt;</li>
<li>&lt;hr&gt;</li>
<li>&lt;input&gt;, &lt;button&gt;, &lt;select&gt;, &lt;textarea&gt;, &lt;fieldset&gt;, &lt;legend&gt;</li>
<li>&lt;iframe&gt;, &lt;embed&gt;, &lt;object&gt;, &lt;applet&gt;</li>
<li>&lt;marquee&gt;</li>
</ul>
<p>下列 CSS 属性和取值将会让一个元素获得 layout：</p>
<ul>
<li>position: absolute<br />
绝对定位元素的包含区块(containing block)就会经常在这一方面出问题。</li>
<li>float: left|right<br />
由于 layout 元素的特性，浮动模型会有很多怪异的表现。</li>
<li>display: inline-block<br />
当一个内联级别的元素需要 layout 的时候往往就要用到它，这也可能也是这个 CSS 属性的唯一效果&#8211;让某个元素拥有 layout。&#8221;inline-block行为&#8221;在IE中是可以实现的，但是非常与众不同： IE/Win: inline-block and hasLayout 。</li>
<li>width: 除 &#8220;auto&#8221; 外的任意值<br />
很多人遇到 layout 相关问题发生时，一般都会先尝试用这个来修复。</li>
<li>height: 除 &#8220;auto&#8221; 外的任意值<br />
height: 1% 就在 Holly Hack 中用到。</li>
<li>zoom: 除 &#8220;normal&#8221; 外的任意值<br />
IE专有属性。不过 zoom: 1 可以临时用做调试。</li>
<li>writing-mode: tb-rl<br />
MS专有属性。</li>
<li>overflow: hidden|scroll|auto<br />
在 IE7 中，overflow 也变成了一个 layout 触发器，这个属性在之前版本 IE 中没有触发 layout 的功能。</li>
<li>overflow-x|-y: hidden|scroll|auto<br />
overflow-x 和 overflow-y 是 CSS3 盒模型中的属性，尚未得到浏览器的广泛支持。他们在之前版本IE中没有触发 layout 的功能。</li>
<li>另外 IE7 的荧幕上又新添了几个 haslayout 的演员，如果只从 hasLayout 这个方面考虑，min/max 和 width/height 的表现类似，position 的 fixed 和 absolute 也是一模一样。</li>
<li>position: fixed</li>
<li>min-width: 任意值<br />
就算设为0也可以让该元素获得 layout。</li>
<li>max-width: 除 &#8220;none&#8221; 之外的任意值</li>
<li>min-height: 任意值<br />
即使设为0也可以让该元素的 haslayout=true</li>
<li>max-height: 除 &#8220;none&#8221; 之外的任意值</li>
</ul>
<h3>有关内联级别元素</h3>
<p>对于内联元素(可以是默认即为内联的比如 span 元素，也可以是 display: inline 的元素)</p>
<ul>
<li>width 和 height 只在 IE5.x 下和 IE6 或更新版本的 quirks 模式下触发 hasLayout 。而对于 IE6，如果浏览器运行于标准兼容模式下，内联元素会忽略 width 或 height 属性，所以设置 width 或 height 不能在此种情况下令该元素具有 layout。</li>
<li>zoom 总是可以触发 hasLayout，但是在 IE5.0 中不支持。</li>
</ul>
<p>具有&#8221;layout&#8221; 的元素如果同时也 display: inline ，那么它的行为就和标准中所说的 inline-block 很类似了：在段落中和普通文字一样在水平方向和连续排列，受 vertical-align 影响，并且大小可以根据内容自适应调整。这也可以解释为什么单单在 IE/Win 中内联元素可以包含块级元素而少出问题，因为在别的浏览器中 display: inline 就是内联，不像 IE/Win 一旦内联元素拥有 layout 还会变成 inline-block。</p>
<h3>重置 hasLayout</h3>
<p>在另一条规则中重设以下属性为默认值将重置(或撤销)hasLayout，如果没有其他属性再添加 hasLayout 的话：</p>
<ul>
<li>width, height (设为 &#8220;auto&#8221;)</li>
<li>max-width, max-height (设为 &#8220;none&#8221;)(在 IE 7 中)</li>
<li>position (设为 &#8220;static&#8221;)</li>
<li>float (设为 &#8220;none&#8221;)</li>
<li>overflow (设为 &#8220;visible&#8221;) (在 IE 7 中)</li>
<li>zoom (设为 &#8220;normal&#8221;)</li>
<li>writing-mode (从 &#8220;tb-rl&#8221; 设为 &#8220;lr-t)</li>
</ul>
<p>display 属性的不同：当用&#8221;inline-block&#8221;设置了 haslayout = true 时，就算在一条独立的规则中覆盖这个属性为&#8221;block&#8221;或&#8221;inline&#8221;，haslayout 这个标志位也不会被重置为 false。</p>
<p>把 mid-width, mid-height 设为它们的默认值&#8221;0&#8243;仍然会赋予 hasLayout，但是 IE 7 却可以接受一个不合法的属性&#8221;auto&#8221;来重置 hasLayout。</p>
<p class="zoundry_raven_tags"><!-- Tag links generated by Zoundry Raven. Do not manually edit. http://www.zoundryraven.com --> <span class="ztags"><span class="ztagspace">Technorati</span> : <a class="ztag" rel="tag" href="http://www.technorati.com/tag/css">css</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/haslayout">haslayout</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/ie">ie</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/web+standard">web standard</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/zoom">zoom</a></span><br />
<span class="ztags"><span class="ztagspace">Del.icio.us</span> : <a class="ztag" rel="tag" href="http://del.icio.us/tag/css">css</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/haslayout">haslayout</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/ie">ie</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/web%20standard">web standard</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/zoom">zoom</a></span><br />
<span class="ztags"><span class="ztagspace">Zooomr</span> : <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=css">css</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=haslayout">haslayout</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=ie">ie</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=web%20standard">web standard</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=zoom">zoom</a></span><br />
<span class="ztags"><span class="ztagspace">Flickr</span> : <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/css">css</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/haslayout">haslayout</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/ie">ie</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/web%20standard">web standard</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/zoom">zoom</a></span><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/" rel="bookmark" title="10/11/2008">IE调试环境中选择IE8+iedevelopbar的原因</a></li>
<li><a href="http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/" rel="bookmark" title="21/12/2008">flash 在浏览器中大小</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
<li><a href="http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/" rel="bookmark" title="30/10/2008">(X)HTML Strict 下的嵌套规则</a></li>
</ul>
<p><!-- Similar Posts took 12.227 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>CSS 框架结构</title>
		<link>http://adamghost.com/2008/12/css-framework/</link>
		<comments>http://adamghost.com/2008/12/css-framework/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 01:19:57 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[team]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=94</guid>
		<description><![CDATA[
分工的出现，导致生产力的进一步发展。做设计、CSS能够合理化的分工同样是IT生产力的发展。
我们开发一个项目，会有许多CSS文件，这些CSS文件共同组成了项目的样式表，页面中的样式也同时也会是多个人共同编写的。就像人们穿衣服一样，衣服、裤子、鞋都是不同厂家生产的，怎么分工，怎么协调，成了最重要的工作。
在做了许多设计，HTML CSS 以后，如何把以前的东西、团队的东西很好的复用，减少再次劳动也是提高团队工作效率的一大法宝。
看了A List A Part 的两篇文章Understanding Progressive Enhancement和Progressive Enhancement with CSS再根据自己在项目开发中的一些经验总结出一些东西，现分享出来。
我的CSS文件结构图如下：

注释代码格式：

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Use: Core Styles , Set the core styles
Author: adamghost
Date: 30 October 2008
Created by: adamghost
E-mail:adamghost1@gmail.com
www.adamghost.com
Project: XXX
Page(s): all
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
各文件作用

screen.css 导入其他的样式
page-xx.css 单独页面所需要的样式写这里，在需要的页面中引入
ie(x).css 针对IE不同版本设置hack用的css。需在页面中写ie条件注释
reset.css 重置页面样式
core.css 页面核心效果样式（font, color, line-height, &#8230;a, p, h1, h2, h3, h4, &#8230;)
layout.css 控制页面整体布局
lib.css 可重复使用的库，同时也导入可复用的CSS库
dfw.xx.css dfw代表dreamflywireless，意思是工作室的CSS库文件

这样构架CSS之后的好处

最大程度的复用CSS，每个项目最多不一样的地方在layout.css中，针对每一个项目单独做layout.css就可以。至于core.css里的变化可有针对性的稍作调整。
便于分工协作，layout.css以及core.css核心样式由项目中CSS界面总监负责编写。lib.css中导入样式dfw.xx.css可模块化分工给相应成员，开发时只需页面引入screen.css即可。

缺点以及改善措施

IE6中一个CSS文件中最多能import 31 个 css 文件，可采用垂直import解决此问题。
新增加的CSS文件数量，使请求增加以至于网站响应速度减慢。针对每个项目的独立性，正式发布时，可由程序员写一个程序，将这些样式综合到一个文件里。当然，这里要注意各css文件与图片的相对路径问题。为此，我把dfw.xx.css与lib.css放在同一目录。
多人开发一个项目（网站、界面），我们得有一个《XXX项目界面设计指南》，用来规范页面以及设计的各种细节，以保证项目设计风格、代码风格统一。如下图：

结构文件下载：
 Technorati : html/css, team, web standards
Del.icio.us : [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.adamghost.com/wp-content/uploads/2008/12/progenh.jpg" alt="progenh.jpg" width="540" height="288" /></p>
<p>分工的出现，导致生产力的进一步发展。做设计、CSS能够合理化的分工同样是IT生产力的发展。</p>
<p>我们开发一个项目，会有许多CSS文件，这些CSS文件共同组成了项目的样式表，页面中的样式也同时也会是多个人共同编写的。就像人们穿衣服一样，衣服、裤子、鞋都是不同厂家生产的，怎么分工，怎么协调，成了最重要的工作。</p>
<p>在做了许多设计，HTML CSS 以后，如何把以前的东西、团队的东西很好的复用，减少再次劳动也是提高团队工作效率的一大法宝。</p>
<p>看了A List A Part 的两篇文章<a href="http://www.alistapart.com/articles/understandingprogressiveenhancement" target="_blank">Understanding Progressive Enhancement</a>和<a href="http://www.alistapart.com/articles/progressiveenhancementwithcss" target="_blank">Progressive Enhancement with CSS</a>再根据自己在项目开发中的一些经验总结出一些东西，现分享出来。</p>
<p>我的CSS文件结构图如下：</p>
<p><img src="http://www.adamghost.com/wp-content/uploads/2008/12/css-frame.png" alt="css-frame.png" width="555" height="378" /></p>
<p>注释代码格式：</p>
<div class="code">
<p>:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</p>
<p>Use: Core Styles , Set the core styles<br />
Author: adamghost<br />
Date: 30 October 2008<br />
Created by: adamghost<br />
E-mail:adamghost1@gmail.com<br />
<a href="http://www.adamghost.com">www.adamghost.com</a><br />
Project: XXX<br />
Page(s): all</p>
<p>:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</p></div>
<p>各文件作用</p>
<ul>
<li><strong>screen.css</strong> 导入其他的样式</li>
<li><strong>page-xx.css</strong> 单独页面所需要的样式写这里，在需要的页面中引入</li>
<li><strong>ie(x).css</strong> 针对IE不同版本设置hack用的css。需在页面中写ie条件注释</li>
<li><strong>reset.css</strong> 重置页面样式</li>
<li><strong>core.css</strong> 页面核心效果样式（font, color, line-height, &#8230;a, p, h1, h2, h3, h4, &#8230;)</li>
<li><strong>layout.css</strong> 控制页面整体布局</li>
<li><strong>lib.css</strong> 可重复使用的库，同时也导入可复用的CSS库</li>
<li><strong>dfw.xx.css</strong> dfw代表dreamflywireless，意思是工作室的CSS库文件</li>
</ul>
<p>这样构架CSS之后的好处</p>
<ul>
<li><strong>最大程度的复用CSS，</strong>每个项目最多不一样的地方在layout.css中，针对每一个项目单独做layout.css就可以。至于core.css里的变化可有针对性的稍作调整。</li>
<li><strong>便于分工协作，</strong>layout.css以及core.css核心样式由项目中CSS界面总监负责编写。lib.css中导入样式dfw.xx.css可模块化分工给相应成员，开发时只需页面引入screen.css即可。</li>
</ul>
<p>缺点以及改善措施</p>
<ul>
<li>IE6中一个CSS文件中最多能import 31 个 css 文件，可采用垂直import解决此问题。</li>
<li>新增加的CSS文件数量，使请求增加以至于网站响应速度减慢。针对每个项目的独立性，正式发布时，可由程序员写一个程序，将这些样式综合到一个文件里。当然，这里要注意各css文件与图片的相对路径问题。为此，我把dfw.xx.css与lib.css放在同一目录。</li>
<li>多人开发一个项目（网站、界面），我们得有一个《XXX项目界面设计指南》，用来规范页面以及设计的各种细节，以保证项目设计风格、代码风格统一。如下图：</li>
</ul>
<div id="attachment_95" class="wp-caption alignnone" style="width: 310px"><a href="http://www.adamghost.com/wp-content/uploads/2008/12/design1024x768.png"><img src="http://www.adamghost.com/wp-content/uploads/2008/12/design1024x768-300x258.png" alt="设计规范样稿" title="设计规范样稿" width="300" height="258" class="size-medium wp-image-95" /></a><p class="wp-caption-text">设计规范样稿</p></div>
<p><strong>结构文件下载：</strong><a class="downloadlink" href="http://adamghost.com/wp-content/plugins/download-monitor/download.php?id=3" title="Version1.0 downloaded 252 times" >css frameset (252)</a></p>
<p class="zoundry_raven_tags"><!-- Tag links generated by Zoundry Raven. Do not manually edit. http://www.zoundryraven.com --> <span class="ztags"><span class="ztagspace">Technorati</span> : <a class="ztag" rel="tag" href="http://www.technorati.com/tag/html%2Fcss">html/css</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/team">team</a>, <a class="ztag" rel="tag" href="http://www.technorati.com/tag/web+standards">web standards</a></span><br />
<span class="ztags"><span class="ztagspace">Del.icio.us</span> : <a class="ztag" rel="tag" href="http://del.icio.us/tag/html%2Fcss">html/css</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/team">team</a>, <a class="ztag" rel="tag" href="http://del.icio.us/tag/web%20standards">web standards</a></span><br />
<span class="ztags"><span class="ztagspace">Zooomr</span> : <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=html%2Fcss">html/css</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=team">team</a>, <a class="ztag" rel="tag" href="http://www.zooomr.com/search/photos/?q=web%20standards">web standards</a></span><br />
<span class="ztags"><span class="ztagspace">Flickr</span> : <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/html%2Fcss">html/css</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/team">team</a>, <a class="ztag" rel="tag" href="http://www.flickr.com/photos/tags/web%20standards">web standards</a></span><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/" rel="bookmark" title="10/11/2008">IE调试环境中选择IE8+iedevelopbar的原因</a></li>
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs/" rel="bookmark" title="30/03/2009">Having “layout”</a></li>
<li><a href="http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/" rel="bookmark" title="30/10/2008">(X)HTML Strict 下的嵌套规则</a></li>
</ul>
<p><!-- Similar Posts took 12.094 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/12/css-framework/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XHTML CSS调试的一些思路</title>
		<link>http://adamghost.com/2008/11/xhtml-css-debug-method/</link>
		<comments>http://adamghost.com/2008/11/xhtml-css-debug-method/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 21:20:18 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=62</guid>
		<description><![CDATA[授之以鱼不如授之以渔，在这里就不论述一些CSS Hack和编写的具体错误，我把解决CSS问题的一些思路分享给大家，把自己几年来学习CSS的一些经验分享出来。
调试工具
Firefox

Firebug 
Web Developer 
Dom Inspector 

Download Here: Firefox Add-ons
IE

IE Develop Bar 
DebugBar 
IETester 不同IE版本调式 

调试思路
主要从客观和主观两方面解决调试问题。
客观
在CSS调试过程中，经验会因为一些客观的因素导致莫名奇妙的问题，就好比做实验时的外界因素的影响。有过一段经历，调试一个页面时一直都不正确，花了很长时间用单元测试的方法终于发现了问题，原来是把label写成了lable（这不尽让我想起了《德国专家的故事》读者上看的，貌似是这名）。所以我们在做研究的时候将客观的外界因素全部去掉，开发起来才能得心应手。针对CSS的编写主要从以下几个方面入手：

样式是否被调用使用IE Develop Bar, Web Developer中的Disable Cache；找到相应元素，查看是否调用样式 
清除浏览器默认样式编写CSS之前先清除掉浏览器默认样式，可以让我们在调试过程中忽略不同浏览器的渲染不同。这里Yahoo YUI的yui.css和A list A part的reset.css都挺好用。在实际运用中，我认为用*{padding:0px;margin:0px} a img{border:none}就足以应付了，至于list-style可以在单独设置，没必要一开始都去掉。 
DOCTYPE确认页面是否声明DOCTYPE，DOCTYPE的不同会影响浏览器的渲染方式。 
CSS语法检查检查样式名有无拼写错误、是否忘记结尾 } 等。标点符号,;。可以用CleanCSS检查 CSS的拼写错误。 
XHTML标签检查使用Dreamweaver中用Ctrl+[选择父级标签，Ctrl+Shift合并标签，逐级检查是否封闭，用Dreamweaver的Validate就可以啦。 
优先级id, class, style优先级大家都不会出错，当多个CLASS重叠时样式表中的排序会产生很大的影响。（如class=&#34;a b c&#34;时a b c在样式表中的排序就会有影响）。 
检查字符留意空格或者编码的问题，firebug 很容易就查出他们的问题，查一下头部是否有多余字符或者文档中是否有text节点。 

主观
主管因素主要是技术上的问题，编写XHTML CSS经验多了之后，不知不觉就很少会出现预料之外的事了。到后期能够基本上不使用HACK以保证每个浏览器都兼容，如双margin问题，思路较清晰在一开始就用padding完全防止他的发生。

预判是技术问题还是是bug？ 
渲染引擎知其然，不知其所以然。了解各浏览器的渲染引擎有助于帮助大家预断HACK，后面的文章再讲啦。 
单元测试CSS布局里面采用流式布局常常会相互影响，把各个模块分离出来单独调试。 
Clear这个是CSS布局中最让人头疼的问题了，需对clear产生的原因非常了解才能灵活运用。为什么需要clear，clear有什么好处，后面的文章讲。 
Reflow减少reflow的使用，具体的会写一篇专门关于这个的文章给大家哈。 
小技巧记住一些不得不记的小技巧，如图片垂直居中等。 

相关文章:


CSS 框架结构
IE调试环境中选择IE8+iedevelopbar的原因
IE Haslayout 详解
CSS XHTML [...]]]></description>
			<content:encoded><![CDATA[<p>授之以鱼不如授之以渔，在这里就不论述一些CSS Hack和编写的具体错误，我把解决CSS问题的一些思路分享给大家，把自己几年来学习CSS的一些经验分享出来。</p>
<h3>调试工具</h3>
<h4>Firefox</h4>
<ol>
<li><strong>Firebug</strong> </li>
<li><strong>Web Developer</strong> </li>
<li><strong>Dom Inspector</strong> </li>
</ol>
<p>Download Here: <a href="https://addons.mozilla.org/en-US/firefox" target="_blank">Firefox Add-ons</a></p>
<h4>IE</h4>
<ol>
<li><strong>IE Develop Bar</strong> </li>
<li><a href="http://www.debugbar.com/" target="_blank"><strong>DebugBar</strong></a> </li>
<li><a href="http://www.my-debugbar.com/wiki/" target="_blank"><strong>IETester</strong></a> 不同IE版本调式 </li>
</ol>
<h3>调试思路</h3>
<p>主要从客观和主观两方面解决调试问题。</p>
<h4>客观</h4>
<p>在CSS调试过程中，经验会因为一些客观的因素导致莫名奇妙的问题，就好比做实验时的外界因素的影响。有过一段经历，调试一个页面时一直都不正确，花了很长时间用单元测试的方法终于发现了问题，原来是把label写成了lable（这不尽让我想起了《德国专家的故事》读者上看的，貌似是这名）。所以我们在做研究的时候将客观的外界因素全部去掉，开发起来才能得心应手。针对CSS的编写主要从以下几个方面入手：</p>
<ol>
<li><strong>样式是否被调用</strong>使用IE Develop Bar, Web Developer中的Disable Cache；找到相应元素，查看是否调用样式 </li>
<li><strong>清除浏览器默认样式</strong>编写CSS之前先清除掉浏览器默认样式，可以让我们在调试过程中忽略不同浏览器的渲染不同。这里<a href="http://developer.yahoo.net/yui" target="_blank">Yahoo YUI</a>的<a href="D:Program FilesZoundry RavenprofilesMy Profiletempwp-contentuploadsyuiyui.css" target="_blank">yui.css</a>和<a href="http://www.alistapart.com" target="_blank">A list A part</a>的<a href="D:Program FilesZoundry RavenprofilesMy Profiletempwp-contentuploadsalapartreset.css" target="_blank">reset.css</a>都挺好用。在实际运用中，我认为用*{padding:0px;margin:0px} a img{border:none}就足以应付了，至于list-style可以在单独设置，没必要一开始都去掉。 </li>
<li><strong>DOCTYPE</strong>确认页面是否声明DOCTYPE，DOCTYPE的不同会影响浏览器的渲染方式。 </li>
<li><strong>CSS语法检查</strong>检查样式名有无拼写错误、是否忘记结尾 } 等。标点符号,;。可以用<a href="http://www.cleancss.com" target="_blank">CleanCSS</a>检查 CSS的拼写错误。 </li>
<li><strong>XHTML标签检查</strong>使用Dreamweaver中用Ctrl+[选择父级标签，Ctrl+Shift合并标签，逐级检查是否封闭，用Dreamweaver的Validate就可以啦。 </li>
<li><strong>优先级</strong>id, class, style优先级大家都不会出错，当多个CLASS重叠时样式表中的排序会产生很大的影响。（如class=&quot;a b c&quot;时a b c在样式表中的排序就会有影响）。 </li>
<li><strong>检查字符</strong>留意空格或者编码的问题，firebug 很容易就查出他们的问题，查一下头部是否有多余字符或者文档中是否有text节点。 </li>
</ol>
<h4>主观</h4>
<p>主管因素主要是技术上的问题，编写XHTML CSS经验多了之后，不知不觉就很少会出现预料之外的事了。到后期能够基本上不使用HACK以保证每个浏览器都兼容，如双margin问题，思路较清晰在一开始就用padding完全防止他的发生。</p>
<ol>
<li><strong>预判</strong>是技术问题还是是bug？ </li>
<li><strong>渲染引擎</strong>知其然，不知其所以然。了解各浏览器的渲染引擎有助于帮助大家预断HACK，后面的文章再讲啦。 </li>
<li><strong>单元测试</strong>CSS布局里面采用流式布局常常会相互影响，把各个模块分离出来单独调试。 </li>
<li><strong>Clear</strong>这个是CSS布局中最让人头疼的问题了，需对clear产生的原因非常了解才能灵活运用。为什么需要clear，clear有什么好处，后面的文章讲。 </li>
<li><strong>Reflow</strong>减少reflow的使用，具体的会写一篇专门关于这个的文章给大家哈。 </li>
<li><strong>小技巧</strong>记住一些不得不记的小技巧，如图片垂直居中等。 </li>
</ol>
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/css-framework/" rel="bookmark" title="03/12/2008">CSS 框架结构</a></li>
<li><a href="http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/" rel="bookmark" title="10/11/2008">IE调试环境中选择IE8+iedevelopbar的原因</a></li>
<li><a href="http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/" rel="bookmark" title="10/12/2008">IE Haslayout 详解</a></li>
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2008/12/flash-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e4%b8%ad%e5%a4%a7%e5%b0%8f/" rel="bookmark" title="21/12/2008">flash 在浏览器中大小</a></li>
</ul>
<p><!-- Similar Posts took 10.226 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/11/xhtml-css-debug-method/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IE调试环境中选择IE8+iedevelopbar的原因</title>
		<link>http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/</link>
		<comments>http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 18:48:28 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[iedevelopbar]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=57</guid>
		<description><![CDATA[Iedevelopbar 在IE8中的功能相对于在IE7中，做了很多方便开发者的设计。以下主要是我使用过程中的一些体会，旧有的和一些基本的功能就略过了。
 

多种环境IE8安装iedevelopbar后可同时使用IE7, IE8环境。并且支持Quirks Mode 和 Standard Mode之间的转换。


样式跟踪用这个，你可以体会到FIREFOX中Firebug和Dom Inspector的优点。可以看到每个样式的来源，而且可以在class中直接修改。这个改进是在IE7中最让人难受的一点&#8211;IE7只能在当前元素添加style。


快捷键ie8对developbar的支持有很大加强，iedevelopbar在7中是以BHO模式安装，首先在效率上面无法赶上IE8，其次BHO模式不支持快捷键，当在没有 menubar 和 toolbar 的窗口中使用时你可以按F12方便的激活iedevelopbar.

相关文章:


CSS 框架结构
IE Haslayout 详解
XHTML CSS调试的一些思路
拥有布局 IE haslayout
(X)HTML Strict 下的嵌套规则


]]></description>
			<content:encoded><![CDATA[<p>Iedevelopbar 在IE8中的功能相对于在IE7中，做了很多方便开发者的设计。以下主要是我使用过程中的一些体会，旧有的和一些基本的功能就略过了。</p>
<p> <span id="more-57"></span>
<ol>
<li><strong>多种环境</strong>IE8安装iedevelopbar后可同时使用IE7, IE8环境。并且支持Quirks Mode 和 Standard Mode之间的转换。</li>
<li style="LIST-STYLE-TYPE: none"><img src="http://www.adamghost.com/wp-content/uploads/2008/11/image001.png" alt="image001.png" height="109" width="293"/></li>
<li style="LIST-STYLE-TYPE: none"><img src="http://www.adamghost.com/wp-content/uploads/2008/11/image002.png" alt="image002.png" height="112" width="386"/></li>
<li><strong>样式跟踪</strong>用这个，你可以体会到FIREFOX中Firebug和Dom Inspector的优点。可以看到每个样式的来源，而且可以在class中直接修改。这个改进是在IE7中最让人难受的一点&#8211;IE7只能在当前元素添加style。</li>
<li style="LIST-STYLE-TYPE: none"><img src="http://www.adamghost.com/wp-content/uploads/2008/11/image003.png" alt="image003.png" height="361" width="599"/></li>
<li style="LIST-STYLE-TYPE: none"><img src="D:\Program Files\Zoundry Raven\profiles\My Profile\resourcestore\image004.png" alt="image004.png" height="233" width="303"/></li>
<li><strong>快捷键</strong>ie8对developbar的支持有很大加强，iedevelopbar在7中是以BHO模式安装，首先在效率上面无法赶上IE8，其次BHO模式不支持快捷键，当在没有 menubar 和 toolbar 的窗口中使用时你可以按F12方便的激活iedevelopbar.</li>
</ol>
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/css-framework/" rel="bookmark" title="03/12/2008">CSS 框架结构</a></li>
<li><a href="http://adamghost.com/2008/12/ie-haslayout-%e8%af%a6%e8%a7%a3/" rel="bookmark" title="10/12/2008">IE Haslayout 详解</a></li>
<li><a href="http://adamghost.com/2008/11/xhtml-css-debug-method/" rel="bookmark" title="12/11/2008">XHTML CSS调试的一些思路</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
<li><a href="http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/" rel="bookmark" title="30/10/2008">(X)HTML Strict 下的嵌套规则</a></li>
</ul>
<p><!-- Similar Posts took 8.584 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/11/ie%e8%b0%83%e8%af%95%e7%8e%af%e5%a2%83%e4%b8%ad%e9%80%89%e6%8b%a9ie8iedevelopbar%e7%9a%84%e5%8e%9f%e5%9b%a0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(X)HTML Strict 下的嵌套规则</title>
		<link>http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/</link>
		<comments>http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 14:00:19 +0000</pubDate>
		<dc:creator>不一样的蚊子</dc:creator>
				<category><![CDATA[WEB规范]]></category>
		<category><![CDATA[嵌套规则]]></category>
		<category><![CDATA[标签嵌套]]></category>

		<guid isPermaLink="false">http://www.adamghost.com/?p=30</guid>
		<description><![CDATA[记得两年前写页面的时候，LI、DIV等标签疯狂用，不停的嵌套。做完一些项目回头分析，逐渐发现一些嵌套上的问题。嵌套的错误可能会导致一些意想不到的页面显示问题。正关心着这事呢，JunChen Wu翻译的Allowed nesting of elements in HTML 4 Strict (and XHTML 1.0 Strict)真是及时雨，将这表打印了放在显示器旁，日久生情就把它牢记，再后来页面也基本上没出现过嵌套的问题和疑惑。
两年后的今天，和小昭同学讨论起这个问题，赶紧拿出来温习下。
非常感谢JunChen Wu的(X)HTML Strict 下的嵌套规则，也同时将文章转过来。
下面是一份在 HTML 4 Strict 和 XHTML 1.0 Strict 下必须遵守的标签嵌套规则，比如你不能在 &#60;a&#62; 里面再嵌入一个 &#60;a&#62; 这样的约定。
说明：

为了方便读者阅读，本文中的标签使用了大写（根据 XHTML 的规则，元素名必须小写，比如 &#60;html&#62; 而不应是 &#60;HTML&#62;）
小写的单词表明一组或一系列 HTML 标签
每一项条目（标签）后都跟随一组标签列表，如果没有这个列表，那么表明该条目（标签）内部不允许包含任何标签。这意味着该条目内部只能包含纯文本 内容（#PCDATA，见下文）。如果注明 (empty)，这意味着该条目内部不允许包含任何形式的内容。对于 flow，inline，block，OBJECT 和 BODY，其内部允许包含的内容在文中会单独给出。
#PCDATA 的意思是“parsed character data”，即纯文本内容（不包括任何 HTML 标签，但是转义内容可以存在，比如 &#38;auml; 和 &#38;#228;）
CDATA 的意思是“character data”，这意味着不包括转义内容的纯文本内容，详细内容可以参考CDATA Confusion
excluding &#8230; 意即不得直接或者间接的包含所列的元素


相关文章:


CSS 框架结构
XHTML CSS调试的一些思路
CSS [...]]]></description>
			<content:encoded><![CDATA[<p>记得两年前写页面的时候，LI、DIV等标签疯狂用，不停的嵌套。做完一些项目回头分析，逐渐发现一些嵌套上的问题。嵌套的错误可能会导致一些意想不到的页面显示问题。正关心着这事呢，<a href="http://www.junchenwu.com/" target="_blank">JunChen Wu</a>翻译的<a href="http://www.cs.tut.fi/~jkorpela/html/strict.html">Allowed nesting of elements in HTML 4 Strict (and XHTML 1.0 Strict)</a>真是及时雨，将这表打印了放在显示器旁，日久生情就把它牢记，再后来页面也基本上没出现过嵌套的问题和疑惑。<br />
两年后的今天，和小昭同学讨论起这个问题，赶紧拿出来温习下。<span id="more-30"></span><br />
非常感谢JunChen Wu的<a href="http://www.junchenwu.com/2007/01/allowed_nesting_of_elements_in_html_4_strict_and_xhtml_10_strict.html">(X)HTML Strict 下的嵌套规则</a>，也同时将文章转过来。</p>
<p>下面是一份在 HTML 4 Strict 和 XHTML 1.0 Strict 下必须遵守的标签嵌套规则，比如你不能在 <code>&lt;a&gt;</code> 里面再嵌入一个 <code>&lt;a&gt;</code> 这样的约定。</p>
<p><strong>说明：</strong></p>
<ul>
<li>为了方便读者阅读，本文中的标签使用了大写（根据 XHTML 的规则，元素名必须小写，比如 <code>&lt;html&gt;</code> 而不应是 <code>&lt;HTML&gt;</code>）</li>
<li>小写的单词表明一组或一系列 HTML 标签</li>
<li>每一项条目（标签）后都跟随一组标签列表，如果没有这个列表，那么表明该条目（标签）内部不允许包含任何标签。这意味着该条目内部只能包含纯文本 内容（#PCDATA，见下文）。如果注明 (empty)，这意味着该条目内部不允许包含任何形式的内容。对于 flow，inline，block，OBJECT 和 BODY，其内部允许包含的内容在文中会单独给出。</li>
<li><a href="http://www.webreference.com/dlab/books/html/3-5.html#3-5-2-2">#PCDATA</a> 的意思是“parsed character data”，即纯文本内容（不包括任何 HTML 标签，但是转义内容可以存在，比如 <code>&amp;auml;</code> 和 <code>&amp;#228;</code>）</li>
<li>CDATA 的意思是“character data”，这意味着不包括转义内容的纯文本内容，详细内容可以参考<a href="http://www.flightlab.com/%7Ejoe/sgml/cdata.html">CDATA Confusion</a></li>
<li>excluding &#8230; 意即不得直接或者间接的包含所列的元素</li>
</ul>
<p><img class="size-full wp-image-4" title="allowednesting.gif" src="/wp-content/uploads/2008/10/allowednesting.gif" alt="(X)HTML Strict 下的嵌套规则" width="579" height="1370" /><br />
<h3>相关文章:<br />
<h3>
<ul class="list-related">
<li><a href="http://adamghost.com/2008/12/css-framework/" rel="bookmark" title="03/12/2008">CSS 框架结构</a></li>
<li><a href="http://adamghost.com/2008/11/xhtml-css-debug-method/" rel="bookmark" title="12/11/2008">XHTML CSS调试的一些思路</a></li>
<li><a href="http://adamghost.com/2009/01/css-xhtml-%e7%9b%b8%e5%85%b3%e8%b5%84%e6%ba%90%e6%95%b4%e5%90%88/" rel="bookmark" title="21/01/2009">CSS XHTML 相关资源整合</a></li>
<li><a href="http://adamghost.com/2009/01/xhtml-css-tools-collection/" rel="bookmark" title="21/01/2009">XHTML CSS Tools collection</a></li>
<li><a href="http://adamghost.com/2009/03/ie-has-layout-and-bugs-zh/" rel="bookmark" title="30/03/2009">拥有布局 IE haslayout</a></li>
</ul>
<p><!-- Similar Posts took 9.235 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://adamghost.com/2008/10/xhtml-strict-%e4%b8%8b%e7%9a%84%e5%b5%8c%e5%a5%97%e8%a7%84%e5%88%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
