<?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>PageTalks &#187; XHTML</title>
	<atom:link href="http://pagetalks.com/category/coding/xhtml/feed" rel="self" type="application/rss+xml" />
	<link>http://pagetalks.com</link>
	<description>Pure Web Development &#38; Design Ideas</description>
	<lastBuildDate>Sun, 05 Sep 2010 06:24:41 +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>12 Tips for a More Accessible Website</title>
		<link>http://pagetalks.com/2010/03/23/12-tips-for-a-more-accessible-website.html</link>
		<comments>http://pagetalks.com/2010/03/23/12-tips-for-a-more-accessible-website.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:04:43 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[Digest]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[accessiblity]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=361</guid>
		<description><![CDATA[Making your website accessible to everyone is not only a moral duty, it’s a legal obligation. Many organizations, including the International Olympic Committee, have been sued for not making their websites accessible enough. With 50 million Americans s... ]]></description>
			<content:encoded><![CDATA[<div class="text-en" lang="en">
Making your website accessible to everyone is not only a moral duty, it’s a legal obligation. Many organizations, including the International Olympic Committee, have been sued for not making their websites accessible enough. With 50 million Americans suffering from some disability or other, improving your site’s accessibility makes clear commercial sense too.</p>
<p>It’s not just those labeled as ‘disabled’ who stand to gain either. Research suggests that 57% of adult computer users will benefit from enhanced accessibility of some kind. Only 19% of websites currently meet the most basic accessibility requirements, so you can really stand out from the competition by making a few changes to your site.</p>
<p>In this article, we explore 12 ways in which you can make your site more accessible. Some methods are very cheap and quick to implement, others require a little more time and financial investment, but you should think of them as business opportunities. With the internet so central to all of our lives these days, it’s unfair that some people are being left behind.
</p></div>
<div class="text-cn" lang="zh">
增加可访问性可以笼统的理解为能让更多人有效的理解应用程序所传达的内容。你需要考虑的是一个构造良好的页面、在尽可能多的环境下可用的内容展现、对特殊人士的关怀⋯⋯<br />
老外的12条遵则对中国大多数网站都是对牛弹琴，很可能从成本上我们的项目就无法兼顾这些东西，不过还是很值得学习的，这毕竟是未来的趋势。
</div>
<p><a href="http://designshack.co.uk/articles/accessibility/12-tips-for-a-more-accessible-website" class="external digest-continue more-link">Read More</a></p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2010/03/23/12-tips-for-a-more-accessible-website.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Style in Actions</title>
		<link>http://pagetalks.com/2009/06/28/print-style-in-actions.html</link>
		<comments>http://pagetalks.com/2009/06/28/print-style-in-actions.html#comments</comments>
		<pubDate>Sun, 28 Jun 2009 07:49:51 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Technique]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=263</guid>
		<description><![CDATA[Recently I&#8217;ve read deeply into some books about web standards, and found out people would be pleased if they can just click the print button in a web browser and get everything they want neatly printed. The books lead me to two excellent articles w... ]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve read deeply into some books about web standards, and found out people would be pleased if they can just click the print button in a web browser and get everything they want neatly printed. The books lead me to two excellent articles written by Eric Meyer.<br />
Two articles are: &#8220;CSS Design: Going to Print&#8221; (www.alistapart.com/articles/goingtoprint) and &#8220;Print Different&#8221; (www.meyerweb.com/eric/articles/webrev/200001.html).</p>
<p>And this article is the experiences I got during making the print style for PageTalks.com.<br />
<span id="more-263"></span><br />
Before making a print stlye, the preview is terrible:</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/before.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/before.gif" alt="Before making a print style" title="Before making a print style" width="700" height="810" class="aligncenter size-full wp-image-266" /></a></p>
<h3>What I&#8217;ve been told</h3>
<p>Eric Meyer sums three ways to implement the print style on a web page.</p>
<ul>
<li>&lt;LINK rel=&#8221;stylesheet&#8221; type&#8221;text/css&#8221; href=&#8221;print.css&#8221; media=&#8221;print&#8221;&gt;</li>
<li>@import url(paged.css) print,projection;</li>
<li>@media print {&#8230;}</li>
</ul>
<p>The principles of building a printer-friendly page always require the designers to bear in mind the general idea of saving ink. To do so, we have to accomplish some simple steps:</p>
<ul>
<li>hide all banners</li>
<li>hide all widgets, sidebars, comments and so on</li>
<li>use white background</li>
<li>assign correct font size for printers</li>
</ul>
<p>With the font-size properties, point value is doing a better job here and readers will be more comfortable with serif font-family. Eric chose 12pt for font-size, but I think it&#8217;s pretty huge value for texts. So I use 10pt instead.<br />
In fact, you need to reset all the properties related to typography using pt. E.g:</p>
<pre>body {
font-size: 10pt;
line-height: 15pt;
margin:12pt 6pt;
padding:3pt;
}

body a,body a:link,body:visited,body a:hover,body a:active {
background:#FFF;
color:#000;
text-decoration:none;
}

body h2,body h3,body h4,body h5,body h6 {
line-height:125%;
}

body h1 {
font:bold 10pt/150% helvetica, arial, sans-serif;
letter-spacing:0.3pt;
margin:6pt 0;
text-transform:uppercase;
}

body h2 {
border-bottom:1px dotted #AAA;
font:14pt/150% georgia, times, serif;
margin:18pt 0 6pt;
padding:0 2pt 0 0;
}

body h3 {
font-size:9pt;
margin:18pt 0 6pt;
text-transform:uppercase;
}

body p {
margin:0 0 12pt;
}

body div.entry-date {
border:1px solid #999;
float:right;
font-size:7pt;
margin:0 3pt;
padding:1pt 3pt;
text-transform:uppercase;
}</pre>
<h3>@import Doesn&#8217;t Work</h3>
<p>Don&#8217;t pannic. Firefox does a good job to load import rule with media type. However, it&#8217;s not so lucky with IE6. (I didn&#8217;t test IE7 or IE8, since IE6 users overnumbers  the total users of IE7 and IE8)<br />
IE6 seems to be unable to parse a @import rule with media type like this:</p>
<pre>@import url(paged.css) print,projection;</pre>
<p>Without media type, it can obey the import rule as Firefox does. Believe or not! See my test page and play aroud with IE6: <a href="/wp-content/uploads/2009/06/testimport/testMedaType.html" titles="Test Import rules">Test for Import Rules</a></p>
<p>Declarations of media is supported by IE6, which means you can add do it like this:</p>
<pre>@media print {
@import url("print.css")
}
or just use link tag:
&lt;LINK rel="stylesheet" type"text/css" href="print.css" media="print"&gt;</pre>
<h3>What else should be hidden from printers</h3>
<p>Beside font properties, making unneccessary contents invisible is also a tiring task. Technically, besides the contents we&#8217;ve listed before, we should hide all interactive components like forms,  buttons, inputs and so on. That&#8217;s because users can&#8217;t interact on the papaer and we just save more ink by not printing them at all. E.g:</p>
<p>The comment form is impossible to be used on a paper.</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/Digest-and-Thoughts-on-Web-Standards-Solutions-–-More-on-Styles-–-PageTalks_1246172152789.png"><img src="http://pagetalks.com/wp-content/uploads/2009/06/Digest-and-Thoughts-on-Web-Standards-Solutions-–-More-on-Styles-–-PageTalks_1246172152789.png" alt="Useless Forms on Papers" title="Useless Forms on Papers" width="288" height="365" class="aligncenter size-full wp-image-267" /></a></p>
<p>Some links that triggers a javascript event or point to actions that impossible to take on papers.</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/jQuery-imgDesc-Plugin-–-PageTalks_1246172452810.png"><img src="http://pagetalks.com/wp-content/uploads/2009/06/jQuery-imgDesc-Plugin-–-PageTalks_1246172452810.png" alt="Useless links" title="Useless links" width="440" height="128" class="aligncenter size-full wp-image-264" /></a></p>
<p>Edit link is useless. More often than not, users holding the paper don&#8217;t intend to &#8216;Edit&#8217;.</p>
<pre>/* Hide unneccessary contents */
body div#blog-description,body div.sidebar,body div#access,
body div#globalnav,body span.archive-meta,body div.entry-meta,body div#footer,
body div.navigation,div#respond,div#trackbacks-list,body div.formcontainer,
body form, body div.serve-bar, .comments .comment-meta * {
display:none;
}

/* Hide contents generated by Javascript and flash */
.lang-select ,body div.entry-content embed, body div.entry-content object {
display: none;
}</pre>
<h3>Override CSS</h3>
<p>It&#8217;s ideal to seperate print style and screen style completely. In my case, I don&#8217;t want to rewrite the layout in print style. That means I&#8217;m bound with the troubles of inheritence.</p>
<p>In the CSS for screen, I specify the widths and postions of containers. It&#8217;s time for me to reset it in print style.</p>
<p>You&#8217;d better clear the paddign and margin so as to make most of papers<br />
When assigning width values, avoid use px unit; margin of 5% is prefered</p>
<pre>/* Override the layout for printer */
body #container {
margin: 0;
padding: 0;
width: 100%;
}
body #container #content {
margin: 0;
padding: 10px;
}

body div.entry-content a.more-link {
position: static;
}</pre>
<p>Just watch out if you have to do the similar job.</p>
<h3>Where is my LOGO?</h3>
<p>Clicked the print preview button and found my logo was gone.<br />
It&#8217;s not surprising for you to understand the broswers will hide css background automatically. I use a image replacement technique to display my logo, so the background is just hidden.</p>
<p>The only choice left to me is to use a IMG tag to show the logo.</p>
<p>I re-designed the logo for print and hide it in CSS for screen.</p>
<pre>body #header div#blog-description, body #header h1#blog-title {
display: none;
}

body #header {
width: 257px;
height: 58px;
text-indent: 0px;
top: 0px!important;
left: -10px;
z-index: 11111;
}

#blog-logo {
display: block;
}</pre>
<h3>Final Result</h3>
<p>After multiple tweakings, we finnaly got a nice print stlye:</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/after.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/after.gif" alt="Using a print style" title="Using a print style" width="700" height="847" class="aligncenter size-full wp-image-265" /></a></p>
<p>Try to create your own print style!</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2009/06/28/print-style-in-actions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Digest and Thoughts on Web Standards Solutions &#8211; More on Styles</title>
		<link>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-stlyes.html</link>
		<comments>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-stlyes.html#comments</comments>
		<pubDate>Fri, 26 Jun 2009 15:07:28 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=258</guid>
		<description><![CDATA[This post follows my earlier post Digest and Thoughts on Web Standards Solutions &#8211; Basic Markups. I suggest read that article first and then head to this one. 这篇文章是接着之前的文章写的，建议大家先将之前的文章看看再... ]]></description>
			<content:encoded><![CDATA[<div lang="en" class="text-en">
<strong>This post follows my earlier post <a href="http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-markups.html" title="Earlier post">Digest and Thoughts on Web Standards Solutions &#8211; Basic Markups</a>. I suggest read that article first and then head to this one.</strong>
</div>
<div lang="zh" class="text-cn">
<strong>这篇文章是接着<a href="http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-markups.html">之前的文章</a>写的，建议大家先将之前的文章看看再移步这篇文章。</strong>
</div>
<p><span id="more-258"></span></p>
<div lang="en" class="text-en">
<h3>Applying CSS</h3>
<p>I suppose to move this chapter ahead. Lots of ways to apply CSS to a document:</p>
<h4>Use &lt;style&gt; tag</h4>
<ul>
<li>Browser can&#8217;t cache the css content</li>
<li>Bad for maintaince</li>
<li>Should only be used in development period</li>
</ul>
<p>Wrap the CSS content with CDATA tag, e.g:</p>
<pre>&lt;style type=&quot;text/css&quot;&gt;
&lt;![CDATA[
...CSS declarations here...
]]&gt;
&lt;/style&gt;</pre>
<h4>External CSS</h4>
<p>Insert a link tag inside the head tag:</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;styles.css&quot;/&gt;</pre>
<p>Now the broswer can cache the file and it&#8217;s easy for you to modify.</p>
<h4>@import rules</h4>
<p>Defining the @import rules in CSS is another good option. Ancient browers such as Netscape doesn&#8217;t understant import rule. Therefore they are unable to load CSS assigned in @import rules. We can separate our structured markup from the presentation as much as possible, and then hold design details and styles for browsers that support them. </p>
<pre>&lt;head&gt;
&lt;meta http-equiv=&quot;content-type&quot;content=&quot;text/html;charset=utf-8&quot;/&gt;
&lt;title&gt;Applying CSS&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;lofi.css&quot;/&gt;
&lt;style type=&quot;text/css&quot;&gt;
@import&quot;hifi.css&quot;;
&lt;/style&gt;
&lt;/head&gt;</pre>
<p>Only contemperory bwosers can read hifi.css, while old ones can&#8217;t. And then we can fully use the Cascade feature of CSS to override the properties formerly assigned.</p>
<h4>Inline style</h4>
<p>For temperoray usage only.</p>
<p>CSS can have alternative files to provide users chances to choose which set of stlye to load.</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;default.css&quot;title=&quot;default&quot;/&gt;
&lt;link rel=&quot;alternate stylesheet&quot;type=&quot;text/css&quot;href=&quot;largetext.css&quot;title=&quot;large&quot;/&gt;
&lt;link rel=&quot;alternate stylesheet&quot;type=&quot;text/css&quot;href=&quot;largertext.css&quot;title=&quot;larger&quot;/&gt;</pre>
<p>It&#8217;s a pity that only new brwoser can handle this.</p>
<h3>Print Style</h3>
<p>CSS is not only for computer screen. It can be used for many types of media. However not every type of media support CSS. Printer and screen readers are just two common clients besides computer screen.</p>
<dl>
<dt>By media property</dt>
<dd>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen&quot;href=&quot;screenstyles.css&quot;/&gt;</pre>
<p>media type:http://www.w3.org/TR/CSS21/media.html。</dd>
<dt>@media or @import</dt>
<dd>
<pre>&lt;style type=&quot;text/css&quot;&gt;
@import url(&quot;screenstyles.css&quot;)screen;
@media print{
/* for printers */
}
&lt;/style&gt;</pre>
</dd>
</dl>
<p>Default value for media is all, which means all devices will load this CSS file.</p>
<p>media accept multiple values seperated by blank：</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen,print&quot;href=&quot;screenstyles.css&quot;/&gt;</pre>
<p>or</p>
<pre>&lt;style type=&quot;text/css&quot;&gt;
@import url(&quot;screenandprint.css&quot;)screen,print;
@media print{
/* for printers */
}
&lt;/style&gt;</pre>
<p>In real world, we need to create another CSS for printers.</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen&quot;href=&quot;/css/styles.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;print&quot;href=&quot;/css/print.css&quot;/&gt;</pre>
<p>There are some basic skill you will find useful when making print style: </p>
<ul>
<li>Assigning a value using pt unit as a base font size in BODY, e.g body {font-size: 12pt;}</li>
<li>Hide unneccessary contents such as sidebars and widgets, and so on</li>
<li>Hide your beautiful background. Just leave some important images such as logo. And take speical care with the color they contain.</li>
<li>Make sure users will still distinguish the links and normal text on the paper.</li>
</ul>
<pre>a:link,a:visited{
color:blue;
text-decoration:underline;
}
#content a:link:after,#content a:visited:after{
content:&quot;(&quot;attr(href)&quot;)&quot;;
}</pre>
<p>Here we use pesudo-class :after and :content to modify the text content, which is a very controversial method among designers as they regard it&#8217;s against the idea of CSS<br />
I think it&#8217;s all up to you.</p>
<p>Dan also recommends two articles about print style：</p>
<ul>
<li>http://www.alistapart.com/articles/goingtoprint</li>
<li>http://www.meyerweb.com/eric/articles/webrev/200001.html</li>
</ul>
<h3>CSS Layout</h3>
<p>Dan demonstrates some basic methods to layout with CSS.<br />
Generally it&#8217;s realized by floating and absoulute positioning.<br />
However it&#8217;s definitely not sufficient in real world.<br />
I will give another guide about contemperarory css layout.</p>
<p>Dave also make supplements for us:</p>
<ul>
<li>&quot;The Layout Reservoir&quot;(http://www.bluerobot.com/web/layouts/)</li>
<li>&quot;From Table Hacks to CSS Layout:A Web Designer&#8217;s Journey&quot;(http://www.alistapart.com/articles/journey/)</li>
<li>&quot;CSS Layout Techniques:For Fun and Profit&quot;(http://www.glish.com/css/)</li>
<li>&quot;Little Boxes&quot;(http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html)</li>
<li>&quot;CSS Zen Garden&quot;(http://www.csszengarden.com/)</li>
</ul>
<p>Some are already househeld.</p>
<p>Dan also memtions the irritating box model. Box model is vital in layout, for most strange problems that cost your days to solve are caused by them.<br />
Generally speaking, CSS1 compliant browsers will do as written in W3S specs. The conflict arises in (stupid) IE5. For example:</p>
<pre>#sidebar{
width:200px;
padding:10px;
border:5px solid black;
}</pre>
<p>Correct explaination is as followed: </p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/box-model-1.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/box-model-1.gif" alt="box-model-1" title="box-model-1" width="419" height="270" class="aligncenter size-full wp-image-248" /></a></p>
<p>But in IE5, sad truth is:</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/box-model-2.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/box-model-2.gif" alt="box-model-2" title="box-model-2" width="428" height="308" class="aligncenter size-full wp-image-249" /></a></p>
<p>The solution is using css hack:</p>
<pre>#sidebar{
padding:10px;
border:5px solid black;
width:230px;/*for IE5/Win*/
voice-family:&quot;\&quot;}\&quot;&quot;;
voice-family:inherit;
width:200px;/*actual value*/
}
html&gt;body#sidebar{
width:200px;
}</pre>
<p>We use voice-family  property to mislead IE5 to believe to think this css declaration is ended. However new bwosers will handle the whole declaration nicely. The later width property shall overrides the former one.<br />
The second CSS declaration block is for Opera which unfortunately will be mieled as well. Let&#8217;s give a child selector to confuse old browsers such IE5 but pass to the new borsers.</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/Listamatic-The-IE-box-model-and-Doctype-modes_1246021608084.png"><img src="http://pagetalks.com/wp-content/uploads/2009/06/Listamatic-The-IE-box-model-and-Doctype-modes_1246021608084.png" alt="Listamatic- The IE box model and Doctype modes_1246021608084" title="Listamatic- The IE box model and Doctype modes_1246021608084" width="579" height="217" class="aligncenter size-full wp-image-245" /></a><br />
A chart explaining the behaviours of IE and Doctypes. See more at http://css.maxdesign.com.au/listamatic/about-boxmodel.htm</p>
<p>Last part of this chapter, Dan introduces a useful technique &#8211; Faux Columns.<br />
In the design of CMS, we hope our sidebar can be high enough to reach the bottom so that we can show the background (probably repeated images). But the elements&#8217; height are assigned according to their real height and assign the fixed height before the content is generated is unrealistic.<br />
We can trace the concept of Faux columns to the Alistapart:<br />
&quot;Faux columns&quot;(http://www.alistapart.com/articles/fauxcolumns). </p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/fauxcolumns.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/fauxcolumns.gif" alt="fauxcolumns" title="fauxcolumns" width="599" height="242" class="aligncenter size-full wp-image-251" /></a></p>
<p>The instructions are easy: wrap the #left and #right in a container div, and use CSS to assign background to the container.<br />
The content in the container div will make it tall enough to display the background properly.</p>
<h3>Styling text</h3>
<p>In this chapter, Dan discussed some common css properties to style text:</p>
<ul>
<li>line-height, defines the line height. Commonly use a em based value</li>
<li>font-family, tells the browser to use which font face to display the text. It accept multiple values; The font name contians blank, use quotation marks to wrap it</li>
<li>letter-spaceing, change the space between letters, commonly used in styling the headings</li>
<li>:fisrt-letter pseudo-class is not supported in most mordern broswers. To apply drop cap effect, we need to wrap the first letter with additional tag</li>
<li>text-align, sets the way  the text in a contain align. Can be left, center, right, and justify. Justified text spaces words out so that each line is of equal length, making a tight, defined column.
</li>
<li>text-transform can modify the capitalization of text. Can be upppercase or lowercase</li>
<li>font-variant allows us to render type in small caps (where the text is capitalized with varying character sizes)</li>
<li>text-indent indents the first line of paragraphs</li>
</ul>
<h3>Image Replacement</h3>
<p>In this chapter, Dan introduces some ususal Image Replacement techniques: FIR, LIR, Phark. These techniques are used to solve the dilema that the fonts chosen by designers are often unavaliable in clients. So we just use images to serve as normal texts.</p>
<p>See more at <a href="http://pagetalks.com/2008/08/29/using-background-image-to-replace-text.html" title="Using Background Image to Replace Text">Using Background Image to Replace Text</a></p>
<p>sFir is now more and more popular. You can find the examples right here in PageTalks. All titles here are presented by sFir techniques.</p>
<h3>Styling &lt;body&gt;</h3>
<p>It&#8217;s very interesting to assign class to Body tag. View the source of large CMS, you may find body has classes!<br />
Dan explains that by using class in body, we can:</p>
<ul>
<li>Swich the layout</li>
<li>Specify the CSS property for special pages, e.g body.index#content{&#8230;}, assigining some css property to #content in Index only</li>
<li>You can tell users &#8220;You are here&#8221; in the navi</li>
</ul>
<p>For example, suppose the navi bar is as followed:</p>
<pre>&lt;ul id=&quot;minitabs&quot;&gt;
&lt;li id=&quot;apples_tab&quot;&gt;&lt;a href=&quot;/apples/&quot;&gt;Apples&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;spag_tab&quot;&gt;&lt;a href=&quot;/spaghetti/&quot;&gt;Spaghetti&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;beans_tab&quot;&gt;&lt;a href=&quot;/greenbeans/&quot;&gt;Green Beans&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;milk_tab&quot;&gt;&lt;a href=&quot;/milk/&quot;&gt;Milk&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>Assign id property to body, and write in the CSS like this:</p>
<pre>body#apples#apples_tab a,
body#spag#spag_tab a,
body#beans#beans_tab a,
body#milk#milk_tab a{
color:#000;
background:url(tab_pyra.gif)no-repeat bottom center;
}</pre>
<p>You needn&#8217;t server side script to judge which page the user is in. It&#8217;s only based on HTML tags and CSS.</p>
<h3>Ending</h3>
<p>In this chapter, Dan gives us lots of useful resources to go on our study.</p>
<h4>Public Organizations</h4>
<ul>
<li>W3C &#8211; http://www.w3.org</li>
<li>Web Standards Project &#8211; http://www.webstandards.org</li>
<li>A List Apart http://www.alistapart.com</li>
<li>CSS Zen Garden http://www.csszengarden.com</li>
<li>Dive into Accessibility &#8211; http://www.diveintoaccessibility.org</li>
<li>css-discuss &#8211; http://www.css-discuss.org</li>
<li>Web-Graphics &#8211; web-graphics.com</li>
<li>Digital Web Magazine &#8211; http://www.digital-web.com</li>
<li>The Weekly Standards &#8211; http://www.weeklystandards.com</li>
</ul>
<h4>Inspiration Blogs</h4>
<ul>
<li>Jeffrey Zeldman Presents:The Daily Report &#8211; http://www.zeldman.com</li>
<li>Stopdesign &#8211; http://www.stopdesign.com</li>
<li>mezzoblue &#8211; http://www.mezzoblue.com</li>
<li>meyerweb.com &#8211; http://www.meyerweb.com/</li>
<li>Tantek Celik &#8211; tantek.com/log/</li>
<li>What Do I Know? &#8211; http://www.whatdoiknow.org/</li>
<li>Asterisk* &#8211; http://www.7nights.com/asterisk/</li>
<li>superfluousbanter &#8211; http://www.superfluousbanter.org</li>
<li>Simon Willison&#8217;s Weblog &#8211; simon.incutio.com</li>
<li>Brainstorms and Raves &#8211; http://www.brainstormsandraves.com</li>
<li>Living Can Kill You &#8211; http://www.saila.com/columns/lcky/</li>
</ul>
<h4>Books</h4>
<dl>
<dt>Designing with Web Standards</dd>
<dd>By Jeffrey Zeldman(New Riders,2003)</dd>
<dt>Cascading Style Sheets:The Definitive Guide</dt>
<dd>By Eric Meyer(O&#8217;Reilly&amp;Associates,2000)</dd>
<dt>Speed up Your Site:Web Site Optimization</dt>
<dd>By Andrew B.King(New Riders,2003)
</dd>
</dl>
</div>
<div lang="zh" class="text-cn">
<h3>应用CSS</h3>
<p>个人觉得作者应该把这一章提到前面，笑……<br />
有很多方法可以将CSS应用到文档上</p>
<h4>在文档内部定义&lt;style&gt;元素</h4>
<ul>
<li>这样做浏览器无法缓存CSS文件，降低了页面性能</li>
<li>不利于后期维护CSS</li>
<li>应该仅仅在开发阶段作为调试手段</li>
</ul>
<p>应该用CDATA标记包围CSS代码，示例如下：</p>
<pre>&lt;style type=&quot;text/css&quot;&gt;
&lt;![CDATA[
...CSS declarations here...
]]&gt;
&lt;/style&gt;</pre>
<h4>外部样式表</h4>
<p>在head标签里面，定义一个link元素</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;styles.css&quot;/&gt;</pre>
<p>这样做浏览器可以对这个文件做缓存，而且有利于日后维护</p>
<h4>@import规则</h4>
<p>在CSS文件中定义@import规则，也是一个很好的方法<br />
老的浏览器，诸如Netscape 4.x等不支持import规则，这意味着通过import规则导入的CSS是无法被这些老浏览器看到的。我们可以为不用级别的浏览器指定兼容性方案：</p>
<pre>&lt;head&gt;
&lt;meta http-equiv=&quot;content-type&quot;content=&quot;text/html;charset=utf-8&quot;/&gt;
&lt;title&gt;Applying CSS&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;lofi.css&quot;/&gt;
&lt;style type=&quot;text/css&quot;&gt;
@import&quot;hifi.css&quot;;
&lt;/style&gt;
&lt;/head&gt;</pre>
<p>只有较为现代的浏览器才能读取hifi.css，而老浏览器只能看到lofi.css。建立这种方案，我们应该充分利用CSS的层叠特性，即之后的属性可以覆盖先前定义的属性。</p>
<h4>行内添加样式</h4>
<p>这是最不好的方法，只能用作指定临时样式之用。</p>
<p>CSS的可替换属性可能还很不为人知，其实就是给浏览诸多CSS文件供浏览器加载</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;href=&quot;default.css&quot;title=&quot;default&quot;/&gt;
&lt;link rel=&quot;alternate stylesheet&quot;type=&quot;text/css&quot;href=&quot;largetext.css&quot;title=&quot;large&quot;/&gt;
&lt;link rel=&quot;alternate stylesheet&quot;type=&quot;text/css&quot;href=&quot;largertext.css&quot;title=&quot;larger&quot;/&gt;</pre>
<p>书中给出了定义了不同字体大小下的各个CSS文件，供浏览器选择。通常这是基于浏览器用户界面的操作，老的浏览器可能不支持这个特性。</p>
<h3>打印样式</h3>
<p>CSS的不仅仅是为渲染屏幕效果而产生的，他的目标媒介有很多。但是由于各个厂商都不太遵循网页标准，所以CSS的这些高级功能也就是白费了。不过值得欣慰的是，对于打印机和屏幕阅读器，我们是可以单独为他们指定CSS文档的。</p>
<dl>
<dt>通过media属性指定</dt>
<dd>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen&quot;href=&quot;screenstyles.css&quot;/&gt;</pre>
<p>media的可选项你应该去参考一下http://www.w3.org/TR/CSS21/media.html。</dd>
<dt>@media或@import</dt>
<dd>
<pre>&lt;style type=&quot;text/css&quot;&gt;
@import url(&quot;screenstyles.css&quot;)screen;
@media print{
/*为打印机指定的样式表*/
}
&lt;/style&gt;</pre>
</dd>
</dl>
<p>其实没有指定media属性时，浏览器默认值为all，也就是所有媒介都会读取这个CSS。</p>
<p>media属性允许指定用空格隔开的多个值，例如：</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen,print&quot;href=&quot;screenstyles.css&quot;/&gt;</pre>
<p>或者</p>
<pre>&lt;style type=&quot;text/css&quot;&gt;
@import url(&quot;screenandprint.css&quot;)screen,print;
@media print{
/*为打印机指定的样式表*/
}
&lt;/style&gt;</pre>
<p>实际操作中，我们应该分为两个文件为打印机和屏幕提供样式。</p>
<pre>&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;screen&quot;href=&quot;/css/styles.css&quot;/&gt;
&lt;link rel=&quot;stylesheet&quot;type=&quot;text/css&quot;media=&quot;print&quot;href=&quot;/css/print.css&quot;/&gt;</pre>
<p>在定义打印样式的时候，有一些很基本的技巧：</p>
<ul>
<li>应该在body中指定一个以pt为单位的基准字号</li>
<li>将不必要的内从隐藏，例如侧边栏、文章类表等等</li>
<li>将那些绚烂的背景图片都隐藏起来吧；例如logo之类必要显示的图片，也要注意色彩问题</li>
<li>应该保证在输出纸张上我们依然能分别普通文字和链接文字</li>
</ul>
<pre>a:link,a:visited{
color:blue;
text-decoration:underline;
}
#content a:link:after,#content a:visited:after{
content:&quot;(&quot;attr(href)&quot;)&quot;;
}</pre>
<p>这里用了:after伪类以及content属性，实现了通过CSS修改文本内容，有人评论说这样是有悖于CSS的出众的。大家自己定夺吧。<br />
文中推荐了两篇Eric Meyer的关于打印样式的文章：</p>
<ul>
<li>http://www.alistapart.com/articles/goingtoprint</li>
<li>http://www.meyerweb.com/eric/articles/webrev/200001.html</li>
</ul>
<h3>CSS布局</h3>
<p>这一节里面我们可以看到作者演示了一些基本的布局方法。<br />
浮动实现侧边栏实现双栏布局、浮动双栏实现三栏布局、浮动内容、双浮动、绝对定位侧边栏等等。个人感觉可能由于这本书的限制，介绍的这些布局方法在实际操作中是远远不够用的。我会另外用一篇文章来总结一下对现代CSS布局的学习。<br />
当然文中也给出了一些讲布局的文章：</p>
<ul>
<li>&quot;The Layout Reservoir&quot;(http://www.bluerobot.com/web/layouts/)</li>
<li>&quot;From Table Hacks to CSS Layout:A Web Designer&#8217;s Journey&quot;(http://www.alistapart.com/articles/journey/)</li>
<li>&quot;CSS Layout Techniques:For Fun and Profit&quot;(http://www.glish.com/css/)</li>
<li>&quot;Little Boxes&quot;(http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html)</li>
<li>&quot;CSS Zen Garden&quot;(http://www.csszengarden.com/)</li>
</ul>
<p>有一些是路人皆知的啦……</p>
<p>本节的后半部分作者讲到了盒模型，写的越多对这个东西就会更加熟悉，一开始是相当让人头疼的。大多数莫名其妙的布局问题都是源自于盒模型的兼容性。<br />
总的来说，只要是支持CSS1的浏览器都能够按照W3C所推荐的那样去理解盒模型，主要问题都出现在如IE5这样比较顽固的浏览器上。书中举出了如下的CSS代码</p>
<pre>#sidebar{
width:200px;
padding:10px;
border:5px solid black;
}</pre>
<p>正确的解释应该如下图所示</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/box-model-1.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/box-model-1.gif" alt="box-model-1" title="box-model-1" width="419" height="270" class="aligncenter size-full wp-image-248" /></a></p>
<p>但是在IE5中，结果是这样</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/box-model-2.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/box-model-2.gif" alt="box-model-2" title="box-model-2" width="428" height="308" class="aligncenter size-full wp-image-249" /></a></p>
<p>解决这个问题，目前不叫实用的只有使用hack。</p>
<pre>#sidebar{
padding:10px;
border:5px solid black;
width:230px;/*for IE5/Win*/
voice-family:&quot;\&quot;}\&quot;&quot;;
voice-family:inherit;
width:200px;/*actual value*/
}
html&gt;body#sidebar{
width:200px;
}</pre>
<p>我们用一个不会影响外观的voice-family，传递一个会让IE5误以为这个声明已经结束的符号。但对于新的浏览器，剩下的规则还会继续解析，最后一个width就会覆盖先前的width。而第二个声明，则是因为诸如Opera的CSS2兼容浏览器也会因为那些符号而已为第一条声明提前结束，所以用一个CSS2的子选择符再次写出width属性。</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/Listamatic-The-IE-box-model-and-Doctype-modes_1246021608084.png"><img src="http://pagetalks.com/wp-content/uploads/2009/06/Listamatic-The-IE-box-model-and-Doctype-modes_1246021608084.png" alt="Listamatic- The IE box model and Doctype modes_1246021608084" title="Listamatic- The IE box model and Doctype modes_1246021608084" width="579" height="217" class="aligncenter size-full wp-image-245" /></a><br />
这是一张了解释IE对于盒模型的行为与Doctype的关系的图标。你可以在这里了解更多：http://css.maxdesign.com.au/listamatic/about-boxmodel.htm</p>
<p>本节最后作者介绍了一种非常有趣的招数——伪栏<br />
在一般的CMS设计中，我们往往希望侧边栏能够和整个页面页面一样高，多半是设计师是希望背景图片能够显示完全。但是CSS在默认情况下，会自动适应高度，内容有多高，容器的高度就有多少；倘若你想手动指定高度，实现计算一个CMS系统文章容器的高度也是不现实的。</p>
<p><a href="http://pagetalks.com/wp-content/uploads/2009/06/fauxcolumns.gif"><img src="http://pagetalks.com/wp-content/uploads/2009/06/fauxcolumns.gif" alt="fauxcolumns" title="fauxcolumns" width="599" height="242" class="aligncenter size-full wp-image-251" /></a></p>
<p>&quot;Faux columns&quot;(http://www.alistapart.com/articles/fauxcolumns)也是出现在alistapart里面的概念。实现原理很简单，那就是将#left和#right两个div用一个容器div包裹起来，然后把背景图片指定到这个容器div里面，这样图片的延伸高度就和文章高度一样了。</p>
<h3>设定文本样式</h3>
<p>本节主要介绍了用常用的一些CSS属性来定义文本样式。</p>
<ul>
<li>用line-height定义行高，使用相对单位em会更有效</li>
<li>用font-family指定字体，可以指定多个字体作为备选；若字体名字里面有空格，就要用引号引用</li>
<li>用letter-spaceing来指定字符间距，这是文章标题上常见的效果</li>
<li>虽然用:fisrt-letter这个伪类可以实现段首字母下沉，可是大多数浏览器都不支持这个伪类，所以还是需要手工在断手字母旁边包围一个span，再来操作span的属性</li>
<li>用text-align设定文本的对其方式，除了left、center、right三个常规属性，还有一个justify这种”两端对齐“的方式，这种方式可能让字符之间的间距不规则，但是页面整体效果是整齐的</li>
<li>用text-transform可以将小写字母变大写，大写字母变小写。可选属性是upppercase、lowercase</li>
<li>用font-variant来实现”小型大写字母“（这翻译够绕口吧？原文“Small Caps”）</li>
<li>用text-indent来实现首行缩进，这个缩进仅仅对每一段的第一行有效</li>
</ul>
<h3>图片替换</h3>
<p>这一节讲了FIR、LIR、Phark等常用的图片替换方法<br />
图片替换方法主要是为了解决设计师所用的字体在客户端上不一定存在的困境，往往解决方案是使用图片来代替。<br />
里面讲述的方法在我的<a href="http://pagetalks.com/2008/08/29/using-background-image-to-replace-text.html" title="Using Background Image to Replace Text">另一片文章</a>里面已经都已经涵盖，请自行参考，这里不再赘述。<br />
需要指出的是，现在sFIR技术也很流行，PageTalks的标题都是使用sFIR，sFIR也解决了一些图片替换技术目前无法解决的问题，值得参考。</p>
<h3>为&lt;body&gt;设定样式</h3>
<p>这一节就比较耐人寻味了。其实翻开大型站点的代码，几乎都会发现他们的body上竟然有class属性，作者在此道出了真意：</p>
<ul>
<li>用class随时切换分栏等布局特性</li>
<li>在系统的特定页面指定特定的属性，例如body.index#content{&#8230;}，这样的语法精确的给首页的#content的元素指定了样式</li>
<li>巧妙的实现导航栏的”当前页面提示“</li>
</ul>
<p>示例，假设导航栏的代码是这样的：</p>
<pre>&lt;ul id=&quot;minitabs&quot;&gt;
&lt;li id=&quot;apples_tab&quot;&gt;&lt;a href=&quot;/apples/&quot;&gt;Apples&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;spag_tab&quot;&gt;&lt;a href=&quot;/spaghetti/&quot;&gt;Spaghetti&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;beans_tab&quot;&gt;&lt;a href=&quot;/greenbeans/&quot;&gt;Green Beans&lt;/a&gt;&lt;/li&gt;
&lt;li id=&quot;milk_tab&quot;&gt;&lt;a href=&quot;/milk/&quot;&gt;Milk&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>在不同的页面给body指定相应的id，那么可以在CSS中这样写</p>
<pre>body#apples#apples_tab a,
body#spag#spag_tab a,
body#beans#beans_tab a,
body#milk#milk_tab a{
color:#000;
background:url(tab_pyra.gif)no-repeat bottom center;
}</pre>
<p>这样的好处是不需要在服务器端脚本上写判断页面的逻辑，而仅仅是通过设定id属性和修改CSS完成的。</p>
<h3>下一步</h3>
<p>这节作者给出了很多有用的链接，供大家进一步学习研究</p>
<h4>相关组织</h4>
<ul>
<li>W3C &#8211; http://www.w3.org</li>
<li>Web Standards Project &#8211; http://www.webstandards.org</li>
<li>A List Apart http://www.alistapart.com</li>
<li>CSS Zen Garden http://www.csszengarden.com</li>
<li>Dive into Accessibility &#8211; http://www.diveintoaccessibility.org</li>
<li>css-discuss &#8211; http://www.css-discuss.org</li>
<li>Web-Graphics &#8211; web-graphics.com</li>
<li>Digital Web Magazine &#8211; http://www.digital-web.com</li>
<li>The Weekly Standards &#8211; http://www.weeklystandards.com</li>
</ul>
<h4>创意博客</h4>
<ul>
<li>Jeffrey Zeldman Presents:The Daily Report &#8211; http://www.zeldman.com</li>
<li>Stopdesign &#8211; http://www.stopdesign.com</li>
<li>mezzoblue &#8211; http://www.mezzoblue.com</li>
<li>meyerweb.com &#8211; http://www.meyerweb.com/</li>
<li>Tantek Celik &#8211; tantek.com/log/</li>
<li>What Do I Know? &#8211; http://www.whatdoiknow.org/</li>
<li>Asterisk* &#8211; http://www.7nights.com/asterisk/</li>
<li>superfluousbanter &#8211; http://www.superfluousbanter.org</li>
<li>Simon Willison&#8217;s Weblog &#8211; simon.incutio.com</li>
<li>Brainstorms and Raves &#8211; http://www.brainstormsandraves.com</li>
<li>Living Can Kill You &#8211; http://www.saila.com/columns/lcky/</li>
</ul>
<h4>书籍</h4>
<dl>
<dt>Designing with Web Standards，《网站重构》</dd>
<dd>By Jeffrey Zeldman(New Riders,2003)</dd>
<dt>Cascading Style Sheets:The Definitive Guide，《CSS权威指南》</dt>
<dd>By Eric Meyer(O&#8217;Reilly&amp;Associates,2000)</dd>
<dt>Speed up Your Site:Web Site Optimization</dt>
<dd>By Andrew B.King(New Riders,2003)<br />
第三本书讲的是HTML和CSS的代码优化，貌似国内没有出版，其实这本书也不错：<br />
High Performance WebSites，《高性能网站设计》<br />
Steve Souders(O&#8217;Reilly)，作者是是YUI的高级工程师，书很薄，很快就可以消化，在这里做个小广告</dd>
</dl>
</div>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-stlyes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Digest and Thoughts on Web Standards Solutions &#8211; Basic Markups</title>
		<link>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-basic-markups.html</link>
		<comments>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-basic-markups.html#comments</comments>
		<pubDate>Fri, 26 Jun 2009 14:40:00 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Layout]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=244</guid>
		<description><![CDATA[在图书馆看到这书，早就想拜读一下，考完了伟大的马哲，终于完成我的愿望啦。书的详细信息：http://www.china-pub.com/40160&#038;ref=ps 书拿起来很薄，印刷还算精细。人民邮电出版出版的一系列书... ]]></description>
			<content:encoded><![CDATA[<div lang="zh" class="text-cn">
<a href="http://pagetalks.com/wp-content/uploads/2009/06/web-standards-cn.jpg"><img src="http://pagetalks.com/wp-content/uploads/2009/06/web-standards-cn.jpg" alt="web-standards-cn" title="web-standards-cn" width="200" height="257" class="alignleft size-full wp-image-246" /></a></p>
<p>在图书馆看到这书，早就想拜读一下，考完了伟大的马哲，终于完成我的愿望啦。书的详细信息：http://www.china-pub.com/40160&#038;ref=ps</p>
<p>书拿起来很薄，印刷还算精细。人民邮电出版出版的一系列书顺准都很高，但是翻译的质量参差不齐。这本书翻译质量不敢恭维，很多句子读起来绕口，我只有去查阅英文原版才得以豁然开朗。<br />
原作者是Dan Cederholm，可能这名字没有Dave Shea这些顶级NB人士响亮，但是他的网站Simplebits.com很早就已经被我放到收藏夹里了。</p>
<p>整本书适合懂得XHTML，但是想让自己的页面更接近网页标准的设计师、前端工程师们细读。内容都不是什么新东西，但是算是一个比较实在的小册子。总的来说，是一本优秀的入门级读物。应该与一本《CSS Mastery》相似，大家两者只要收录其一就可以。</p>
<p>本文是我整理的阅读笔记，也是我觉得里面比较精华的内容，供大家参考。如果你发现这些内容已经是烂熟于心，这本书就远远低于你的要求了。（那一定是很N的人了，笑……）
</p></div>
<div lang="en" class="text-en"><a href="http://pagetalks.com/wp-content/uploads/2009/06/web-standards-en.jpg"><img src="http://pagetalks.com/wp-content/uploads/2009/06/web-standards-en.jpg" alt="web-standards-en" title="web-standards-en" width="200" height="240" class="alignleft size-full wp-image-247" /></a></p>
<p>I met this book in the library months ago. Despite the few glimpses in a hurry, I felt it was a great book and made up a mind to produce some time to read it.<br />
Detail about this book:</p>
<p>http://astore.amazon.com/simplebits-20/detail/1590593812</p>
<p>It&#8217;s only a handy book, light and thin. The author is Dan Cederholm, who probably is a nobody in your mind but indeed an expert in Web Standards. Simplebits is his own site and I took it into my favorites long time ago.</p>
<p>On the whole, this book is good enough for those who know the basics about XHTML, but desire to rise into a upper atmosphere of web standards. You may think CSS Mastery is also anther choice. Yes, it&#8217;s very similar to CSS Mastery. In my opinion, just buy either of two.</p>
<p>Following are some my digests and thoughts about this book, for you review. Hope you find it useful.
</p></div>
<p><span id="more-244"></span></p>
<div lang="zh" class="text-cn">
<h3>列表元素</h3>
<ul>
<li>不要用br换行</li>
<li>保持标签闭合</li>
<li>使用li和ul</li>
</ul>
<p>本节中作者讲述了用纯CSS实现一个非常漂亮的导航菜单，值得参考。</p>
<h3>标题</h3>
<ul>
<li>使用h1~h6描述标题</li>
<li>注意标题级别，尽量做到递减</li>
</ul>
<p>本节中描述一种名叫“变色龙效果（The Chameleon Effect）”的技巧。通过运用透明的GIF的IMG元素，并在CSS中设置IMG的background属性，这样可以为透明部分填色。</p>
<pre>
&lt;h3&gt;&lt;img src=&quot;http://images.fastcompany.com/icon/first_imp.gif&quot;width=&quot;13&quot;height=&quot;13&quot;alt=&quot;*&quot;/&gt;FIRST IMPRESSION&lt;/h3&gt;</pre>
<p>仅仅通过更改CSS的属性可以达到更换颜色的目的。这种技巧也可以用来作图像的水影。</p>
<h3>表格数据</h3>
<p>table并不是万恶的，它是XHTML的一部分，表格型数据都应该用table来写，这些数据可能是：</p>
<ul>
<li>日历</li>
<li>工作簿</li>
<li>图表</li>
<li>日程表</li>
</ul>
<p>写表格时应该注意一些细节：</p>
<ul>
<li>加入caption作为表格标题，明确表格内容</li>
<li>设置summary属性介绍table的内容，提高可访问性</li>
<li>活用th表示表头</li>
<li>利用td的headers属性表明数据之间的关系</li>
<li>在th中设置abbr属性设置该表头的简写或概要，为屏幕阅读器提供便利</li>
<li>活用thead、tfoot、tbody增加表格的语义；同时打印输出时，会在每一个单独的纸张上都输出thead和tfoot，提高可读性</li>
</ul>
<p>本节中作者演示了如何用CSS创建基于表格的格点：</p>
<pre>
table{
border-top:1px solid#999;
border-left:1px solid#999;
border-collapse:collapse;
}
th,td{
border-right:1px solid#999;
border-bottom:1px solid#999;
}
</pre>
<p>这里我们通过设置border-collapse完全消除单元格之间的间隙。</p>
<h3>引用文本</h3>
<p>这方面是大多数设计师没有注意的问题了，作者也提出了一些网上常见的做法以及他们的缺点。正确的编写引用文本，应该：</p>
<ul>
<li>用blockquote包围内容</li>
<li>给blockquote添加cite属性，告诉浏览器这段文字来自哪里</li>
<li>如果是行内引用则用q</li>
<li>给q设置lang标签（完整的lang属性可用值，参考http://www.w3.org/TR/html4/struct/dirlang.html#langcodes）</li>
</ul>
<h3>表单</h3>
<p>又是XHTML的一大陷阱，看看高手写出来的表单代码和自己写的就觉得自己没学过XHTML。时常可以看到人们这样做：</p>
<ul>
<li>用br换行</li>
<li>用table布局</li>
<li>使用p和br实现换行</li>
</ul>
<p>书中是这样建议的：</p>
<ul>
<li>对于简单的表单尽量不要用table</li>
<li>对于项目的名称，用label包围</li>
<li>简单的表单通过p、label就可以简单的构件</li>
<li>最极端的状态是用dl、dt、dd来写表单，这样的可读性是最高的</li>
<li>设置input等项目的tabindex属性，提高可用性</li>
<li>为常用项目设置accesskey属性</li>
<li>在同一个form下，利用fieldset给项目分组</li>
<li>利用legengd给每个fieldset提供标题</li>
</ul>
<p>一些实例：</p>
<pre>
&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for=&quot;name&quot;&gt;Name:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;/&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/form&gt;
</pre>
<p>个人的疑虑：这个写法中，dt和dd的个数不匹配，是否完全正确还有待研究。在HTML&amp;XHTML The Definitive Guide中也只是模糊地这样说明：</p>
<blockquote><p>each item name in a&lt;dl&gt;list is marked with the&lt;dt&gt;tag,followed by the item&#8217;s definition or explanation marked by the&lt;dd&gt;tag.</p></blockquote>
<pre>&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;p&gt;&lt;label for=&quot;name&quot;accesskey=&quot;9&quot;&gt;Name:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;tabindex=&quot;1&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;tabindex=&quot;2&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;
tabindex=&quot;3&quot;/&gt;
&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;tabindex=&quot;4&quot;/&gt;&lt;/p&gt;
&lt;/form&gt;</pre>
<pre>&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;fieldset&gt;
&lt;legend&gt;Sign In&lt;/legend&gt;
&lt;p&gt;&lt;label for=&quot;name&quot;accesskey=&quot;9&quot;&gt;Name:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;tabindex=&quot;1&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;tabindex=&quot;2&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;
tabindex=&quot;3&quot;/&gt;
&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;tabindex=&quot;4&quot;/&gt;&lt;/p&gt;
&lt;/fieldset&gt;
&lt;/form&gt;</pre>
<h3>短语元素</h3>
<p>这个也是极容易混淆的地方，面试前端，也许人家就会问你：“&lt;b&gt;和&lt;strong&gt;有什么区别？”<br />
事实上目前实现富有语义的XHTML的最大困难就是设计师不愿意浪费时间来设定这些短语元素。<br />
书中简明扼要的指出：</p>
<blockquote><p>&lt;em&gt;表示强调<br />
&lt;strong&gt;表示更强的强调</p></blockquote>
<ul>
<li>&lt;b&gt;和&lt;strong&gt;在显示效果上都是粗体，但是&lt;strong&gt;能表达语义上的含义，而&lt;b&gt;仅仅进行了视觉上的格式化。当然，这些位置最好使用CSS的font-weight或font-style实现</li>
<li>&lt;i&gt;和&lt;em&gt;和上面同理</li>
</ul>
<pre>Your order number for future reference is:&lt;strong&gt;6474-82071&lt;/strong&gt;.
It took me not one,but&lt;em&gt;three&lt;/em&gt;hours to shovel my driveway this weekend.</pre>
<p>只有上面这两种写法才能正确表示强调。当然不是要求你不用&lt;b&gt;和&lt;i&gt;，事实上有很多位置只需要对其进行视觉上的格式化。<br />
&lt;cite&gt;用来表明引用信息或对其文献的参考说明。示例：</p>
<pre>The novel,&lt;cite&gt;The Scarlet Letter&lt;/cite&gt;is set in Puritan Boston and like this book,was written in Salem,Massachusetts.</pre>
<ul>
<li>&lt;abbr&gt;表示一种简写形式，如WWW、HTTP等，屏幕阅读器将会将其以单个字母地形式读出</li>
<li>&lt;acronym&gt;表示取首字母的缩写形式，屏幕阅读器将会将其作为一个单词读出</li>
<li>设置&lt;abbr&gt;和&lt;acronym&gt;的title属性定义其全称</li>
<li>虽然IE只支持&lt;acronym&gt;，但我们还是应该按照规范来写页面，该用什么用什么</li>
</ul>
<pre>&lt;abbr title=&quot;eXtensible HyperText Markup Language&quot;&gt;XHTML&lt;/abbr&gt;
&lt;acronym title=&quot;North Atlantic Treaty Organization&quot;&gt;NATO&lt;/acronym&gt;</pre>
<p>同时，你可能需要设置CSS来让某些不遵从标准的浏览器实现两者的默认行为：</p>
<pre>abbr{
speak:spell-out;
}
acronym{
speak:normal;
}</pre>
<p>用&lt;code&gt;来展示代码，示例：</p>
<pre>&lt;code&gt;
#content{
width:80%;
padding:20px;
background:blue;
}</pre>
<p>&lt;samp&gt;用于显示程序或脚本的运行输出结果</p>
<pre>&lt;p&gt;When the script has executed,at the command line you will see the message&lt;samp&gt;script was successful!&lt;/samp&gt;.&lt;/p&gt;</pre>
<p>&lt;var&gt;用于指明程序的变量或参数，示例：</p>
<pre>&lt;p&gt;I'm going to pass the parameter&lt;var&gt;lastUpdated&lt;/var&gt;to my main.xsl file.&lt;/p&gt;</pre>
<p>&lt;kbd&gt;用于指明那些需要有用户输入的文本，示例：</p>
<pre>&lt;p&gt;To quickly change focus to the search input field,Mac users type&lt;kbd&gt;Command+9&lt;/kbd&gt;.&lt;/p&gt;</pre>
<h3>锚点</h3>
<p>锚点是互联网中最基本的元素，它的产生出现可以追溯到Internet的第一张网页。<br />
锚点的指向页面内部的一个元素，也可以指向网络上的任何一个URL。<br />
当你需要让锚点指向页面内部元素的时候，你可以：</p>
<pre>&lt;p&gt;&lt;a href=&quot;#orange&quot;&gt;About Orange&lt;/a&gt;&lt;/p&gt;
.......
&lt;h2 id=&quot;orange&quot;&gt;Orange are tasty&lt;/h2&gt;</pre>
<p>如果你想设置一个指向头部的链接，你最好不要用&quot;#top&quot;，因为top是一些浏览器的保留字段。<br />
可能基于某些向前兼容的考虑，会使用name属性，例如：</p>
<pre>&lt;p&gt;&lt;a href=&quot;#orange&quot;&gt;About Orange&lt;/a&gt;&lt;/p&gt;
.......
&lt;h2&gt;&lt;a id=&quot;orange&quot;name=&quot;orange&quot;&gt;Orange are tasty&lt;/a&gt;&lt;/h2&gt;</pre>
<p>但不是每个元素都同时支持name和id属性——只有如下标签是支持的：<br />
&lt;a&gt;、&lt;applet&gt;、&lt;form&gt;、&lt;frame&gt;、&lt;iframe&gt;、&lt;img&gt;、&lt;map&gt;</p>
<p>书中还给出了其他建议：</p>
<ul>
<li>给链接一个title属性，写出该链接的提示文字</li>
<li>注意链接的全局样式</li>
<li>伪类:link可以帮你找到所有有href属性的链接</li>
<li>应该用CSS定义样式将链接突出</li>
<li>伪类的定义顺序必须是:link,:visited,:hover,:active，记忆诀窍是LoVe/HAte</li>
</ul>
<h3>更多关于列表</h3>
<p>这一节作者主要讨论了更多形式的列表，比如有序列表和解释列表。<br />
构造带序号的列表应该使用ol、li，浏览器会自动为li编号<br />
可以定义li的list-style-type来改变编号的类型，可选值为：</p>
<ul>
<li>decimal:1,2,3,4,etc.(commonly the default)</li>
<li>upper-alpha:A,B,C,D,etc.</li>
<li>lower-alpha:a,b,c,d,etc.</li>
<li>upper-roman:I,II,III,IV,etc.</li>
<li>lower-roman:I,ii,iii,iv,etc.</li>
<li>none:No numeral</li>
</ul>
<p>注意，不要直接用ol的type属性来改变编号类型。</p>
<p>对于解释列表，我们可以用dl、dt、dd来描述，这样做的好处除了语义性强之外，在默认状态下就有很高的可读性。</p>
<pre>&lt;dl&gt;
&lt;dt&gt;CSS&lt;/dt&gt;
&lt;dd&gt;A simple mechanism for adding style(e.g.fonts,colors,spacing)to Web documents.&lt;/dd&gt;
&lt;dt&gt;XHTML&lt;/dt&gt;
&lt;dd&gt;A family of current and future document types and modules that reproduce,subset,and extend HTML,reformulated in XML.&lt;/dd&gt;
&lt;dt&gt;XML&lt;/dt&gt;
&lt;dd&gt;A simple,very flexible text format derived from SGML.&lt;/dd&gt;
&lt;/dl&gt;</pre>
<h3>精简代码</h3>
<p>对于CSS新手来说，随意给元素指定class、id会造成日后维护的困难，而且很容易因为CSS的继承而是你无法实现你想要的效果。作者给出了一些建议</p>
<ul>
<li>不要滥用class</li>
<li>活用选择器来节约id、class</li>
<li>在单个元素，例如form、ul、blockquote等又套一层div是不可取的</li>
</ul>
</div>
<div lang="en" class="text-en">
<h3>Lists</h3>
<ul>
<li>Don&#8217;t use br to break a line </li>
<li>Keep the tag closed</li>
<li>Use li with ul</li>
</ul>
<p>In this chapter, Dan use pure css to create a beautiful navi tab, which may inspire you a lot.</p>
<h3>Heading</h3>
<ul>
<li>Use h1~h6 to describe headings</li>
<li>Use them in the descending order</li>
</ul>
<p>Here, we get to know The Chameleon Effect, which take advantages of transparent GIF in a IMG tag. When you change the background property of IMG in CSS, you change the background of the image the users will feel.</p>
<pre>
&lt;h3&gt;&lt;img src=&quot;http://images.fastcompany.com/icon/first_imp.gif&quot;width=&quot;13&quot;height=&quot;13&quot;alt=&quot;*&quot;/&gt;FIRST IMPRESSION&lt;/h3&gt;</pre>
<p>See, you just change the background of a &#8220;image&#8221; through modification of CSS. This will work well when you want add a watermark on your photoes.</p>
<h3>Tabular Data</h3>
<p>Table is not evil, and it&#8217;s part of XHTMl Spec. Tabular data should be described by table tag, e.g:</p>
<ul>
<li>Calender</li>
<li>Spreadsheet</li>
<li>Charts</li>
<li>Schedules</li>
</ul>
<p>Do with more cautions：</p>
<ul>
<li>Add caption tag to serve as a title of the table</li>
<li>Assign summary property to tell users the breif to the table, thus increasing the accessiblity.</li>
<li>use th as cell heading</li>
<li>use the headers property of td tag to show the relations among the data cell</li>
<li>assign abbr property in th to brief the cell heading. This will help screen readers a lot</li>
<li>Use thead, tfoot, tbody to make table more sematic. You will be glad to find table heading and table foot will be displayed on every printed talbes.</li>
</ul>
<p>And the author shows us how to create a grid using table and CSS ：</p>
<pre>
table{
border-top:1px solid#999;
border-left:1px solid#999;
border-collapse:collapse;
}
th,td{
border-right:1px solid#999;
border-bottom:1px solid#999;
}
</pre>
<p>Here we set the border-collpase to collpase the gag between cells.</p>
<h3>Quotations</h3>
<p>It&#8217;s a common pitfall to most designers. Dan lists some methods used widely and tell the goods and bads.</p>
<p>For correct quotations:</p>
<ul>
<li>Use blockquote to wrap the content</li>
<li>Assign cite property to blockquote, telling us where the quotations come from</li>
<li>Use q for inline quotations</li>
<li>Assign lang property for q to tell users in which language the quotaions are (Complete list of the availible values for lang: http://www.w3.org/TR/html4/struct/dirlang.html#langcodes)</li>
</ul>
<h3>Form</h3>
<p>Just another perilous pitfall. Good forms and bad ones differ tremendously.</p>
<p>Sometiems we find people write some like this:</p>
<ul>
<li>Use br to break a line</li>
<li>Use table for layout</li>
<li>Use both p and br to break a line</li>
</ul>
<p>Dave suggests：</p>
<ul>
<li>Nerver use table for simple forms</li>
<li>Wrap the title of input item with label tag</li>
<li>Use p and label for simple forms</li>
<li>For ultimate readablity, use dl, dt, dd to describe a forms</li>
<li>Assign tabindex property for input tags and other interactable components</li>
<li>Assign accesskey property for frequently used elements</li>
<li>Use fieldset to group related form items</li>
</ul>
<li>Use legend in every fildset to give a title for this group of items</li>
</ul>
<p>Some examples：</p>
<pre>
&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;label for=&quot;name&quot;&gt;Name:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;/&gt;&lt;/dd&gt;
&lt;dt&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;/&gt;&lt;/dt&gt;
&lt;/dl&gt;
&lt;/form&gt;
</pre>
<p>In code above, dt and dd are not equally matched, which I doubtly personally. But I can&#8217;t prove this wrong as HTML&amp;XHTML The Definitive Guide give only a dim definition：</p>
<blockquote><p>each item name in a&lt;dl&gt;list is marked with the&lt;dt&gt;tag,followed by the item&#8217;s definition or explanation marked by the&lt;dd&gt;tag.</p></blockquote>
<pre>&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;p&gt;&lt;label for=&quot;name&quot;accesskey=&quot;9&quot;&gt;Name:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;tabindex=&quot;1&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;tabindex=&quot;2&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;
tabindex=&quot;3&quot;/&gt;
&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;tabindex=&quot;4&quot;/&gt;&lt;/p&gt;
&lt;/form&gt;</pre>
<pre>&lt;form action=&quot;/path/to/script&quot;id=&quot;thisform&quot;method=&quot;post&quot;&gt;
&lt;fieldset&gt;
&lt;legend&gt;Sign In&lt;/legend&gt;
&lt;p&gt;&lt;label for=&quot;name&quot;accesskey=&quot;9&quot;&gt;Name:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;name&quot;name=&quot;name&quot;tabindex=&quot;1&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;Email:&lt;/label&gt;&lt;br/&gt;
&lt;input type=&quot;text&quot;id=&quot;email&quot;name=&quot;email&quot;tabindex=&quot;2&quot;/&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;checkbox&quot;id=&quot;remember&quot;name=&quot;remember&quot;
tabindex=&quot;3&quot;/&gt;
&lt;label for=&quot;remember&quot;&gt;Remember this info?&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;input type=&quot;submit&quot;value=&quot;submit&quot;tabindex=&quot;4&quot;/&gt;&lt;/p&gt;
&lt;/fieldset&gt;
&lt;/form&gt;</pre>
<h3>Phase Elements</h3>
<p>These are confusing elements in HTML. You may encounter questions about these when you are applying for a front-end engineer:<br />
“What&#8217;s the difference between &lt;b&gt; and &lt;strong&gt;?”</p>
<p>In fact, most designers are just reluctant commsuming time applying these seemingly insignificant phase elements.<br />
But, these are the very important steps to build more semantic pages.</p>
<p>Dave points out：</p>
<blockquote><p>&lt;em&gt; means emphasis<br />
&lt;strong&gt; means stronger emphasis</p></blockquote>
<ul>
<li>&lt;b&gt; and &lt;strong&gt; both make text bold，but &lt;strong&gt; convery a sematicly emphasizing meaning，while &lt;b&gt; only does the job of  formatting visually。Of course you&#8217;d better to use font-weight and font-style other to make text bold or italic</li>
<li>&lt;i&gt; and &lt;em&gt; are the same story. </li>
</ul>
<pre>Your order number for future reference is:&lt;strong&gt;6474-82071&lt;/strong&gt;.
It took me not one,but&lt;em&gt;three&lt;/em&gt;hours to shovel my driveway this weekend.</pre>
<p>Only the two methods above can show your intended emphasis.</p>
<p>&lt;cite&gt; is used to contain a citation or a reference to other sources, E.g ：</p>
<pre>The novel,&lt;cite&gt;The Scarlet Letter&lt;/cite&gt;is set in Puritan Boston and like this book,was written in Salem,Massachusetts.</pre>
<ul>
<li>&lt;abbr&gt;Indicates an abbreviated form (e.g., WWW, HTTP, URI, Mass., etc.)
</li>
<li>&lt;acronym&gt; Indicates an acronym (e.g., WAC, radar, etc.)</li>
<li>Assign title properties for &lt;abbr&gt; and &lt;acronym&gt; to tell users the full name</li>
<li>Although IE only support &lt;acronym&gt;，we cannot abandon the use of abbr and desert the will of web standards. Just mark the term up according to the specifications. </li>
</ul>
<pre>&lt;abbr title=&quot;eXtensible HyperText Markup Language&quot;&gt;XHTML&lt;/abbr&gt;
&lt;acronym title=&quot;North Atlantic Treaty Organization&quot;&gt;NATO&lt;/acronym&gt;</pre>
<p>There are also two CSS rules that could be added to an aural style sheet to further reinforce these directives:</p>
<pre>abbr{
speak:spell-out;
}
acronym{
speak:normal;
}</pre>
<p>The <code> element is designed for demonstrating code examples within XHTML pages.</p>
<pre>&lt;code&gt;
#content{
width:80%;
padding:20px;
background:blue;
}</pre>
<p>&lt;samp&gt; is used to show sample output from programs and scripts. </p>
<pre>&lt;p&gt;When the script has executed,at the command line you will see the message&lt;samp&gt;script was successful!&lt;/samp&gt;.&lt;/p&gt;</pre>
<p>&lt;var&gt; is used to designate a program parameter or variable.</p>
<pre>&lt;p&gt;I'm going to pass the parameter&lt;var&gt;lastUpdated&lt;/var&gt;to my main.xsl file.&lt;/p&gt;</pre>
<p>&lt;kbd&gt; Indicates text to be entered by the user.</p>
<pre>&lt;p&gt;To quickly change focus to the search input field,Mac users type&lt;kbd&gt;Command+9&lt;/kbd&gt;.&lt;/p&gt;</pre>
<h3>Anchors</h3>
<p>Anchors are the soul of internet and they are the citizens since the birth of internet.</p>
<p>Anchors can be pointed to any URL on the web or any element inside the page. If you want to anchor directs to other part of the page: </p>
<pre>&lt;p&gt;&lt;a href=&quot;#orange&quot;&gt;About Orange&lt;/a&gt;&lt;/p&gt;
.......
&lt;h2 id=&quot;orange&quot;&gt;Orange are tasty&lt;/h2&gt;</pre>
<p>Don't use "top" as a value if you want to make a link that point to the "top" of the page because "top" is often the keyword in a browser.</p>
<p>Taking the compatiblilty issues into accounts, you'd like to use name property as well：</p>
<pre>&lt;p&gt;&lt;a href=&quot;#orange&quot;&gt;About Orange&lt;/a&gt;&lt;/p&gt;
.......
&lt;h2&gt;&lt;a id=&quot;orange&quot;name=&quot;orange&quot;&gt;Orange are tasty&lt;/a&gt;&lt;/h2&gt;</pre>
<p>However, not very elements has both name and id property like the following:<br />
&lt;a&gt;、&lt;applet&gt;、&lt;form&gt;、&lt;frame&gt;、&lt;iframe&gt;、&lt;img&gt;、&lt;map&gt;</p>
<p>Dan also suggests：</p>
<ul>
<li>Assign title property whose value can be used in the tooltip when mouse over</li>
<li>Beware of global link styling</li>
<li>:link pseudo-class can find all the links that have href property</li>
<li>You should always highlight the links among the text</li>
<li>Ordering the four pseudo-classes mentioned becomes important in order for all of them to behave properly—without one overriding the other. The correct order -   :link,:visited,:hover,:active. Maybe this will help you: LoVe/HAte</li>
</ul>
<h3>More on list</h3>
<p>In this chapter, Dan pays more attentions to ordered list and definition list.<br />
The browser will automatically number the li with demical number.<br />
You can change the way thourgh list-style-type property:</p>
<ul>
<li>decimal:1,2,3,4,etc.(commonly the default)</li>
<li>upper-alpha:A,B,C,D,etc.</li>
<li>lower-alpha:a,b,c,d,etc.</li>
<li>upper-roman:I,II,III,IV,etc.</li>
<li>lower-roman:I,ii,iii,iv,etc.</li>
<li>none:No numeral</li>
</ul>
<p>Don't use the type property in a ol tag to alte the list style.</p>
<p>With definition list, we can use dl, dt, dd to describe it. You will get high readablity in default.</p>
<pre>&lt;dl&gt;
&lt;dt&gt;CSS&lt;/dt&gt;
&lt;dd&gt;A simple mechanism for adding style(e.g.fonts,colors,spacing)to Web documents.&lt;/dd&gt;
&lt;dt&gt;XHTML&lt;/dt&gt;
&lt;dd&gt;A family of current and future document types and modules that reproduce,subset,and extend HTML,reformulated in XML.&lt;/dd&gt;
&lt;dt&gt;XML&lt;/dt&gt;
&lt;dd&gt;A simple,very flexible text format derived from SGML.&lt;/dd&gt;
&lt;/dl&gt;</pre>
<h3>Simplifing Markup</h3>
<p>For novices, it's too easy to make another class in CSS which will eventually hinder job in the future as you've got too many class to maintaine.<br />
Some suggestions:</p>
<ul>
<li>Use class wisely</li>
<li>Use descendant selectors instead</li>
<li>Wraping the lements like form, ul, blockquote with another div is not a wise decision</li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2009/06/26/digest-and-thoughts-on-web-standards-solutions-basic-markups.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Fvck That Page</title>
		<link>http://pagetalks.com/2008/08/29/how-to-fvck-that-page.html</link>
		<comments>http://pagetalks.com/2008/08/29/how-to-fvck-that-page.html#comments</comments>
		<pubDate>Fri, 29 Aug 2008 06:46:03 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://pagetalks.com/?p=6</guid>
		<description><![CDATA[为什么你的居中属性没有生效？为什么浮动元素不听你的话？为什么这个图片会这样显示？&#8230;&#8230; 这样或那样的问题困扰着步入网页设计的每个人，以下就以个人经验来来总结一下解决问... ]]></description>
			<content:encoded><![CDATA[<p>为什么你的居中属性没有生效？为什么浮动元素不听你的话？为什么这个图片会这样显示？&#8230;&#8230;<br />
这样或那样的问题困扰着步入网页设计的每个人，以下就以个人经验来来总结一下解决问题的流程。</p>
<h3 class="subtitle">懒人大法——问你的朋友</h3>
<p>如果你有同样做网页设计的朋友，可以和他一起研究，也许他早就你想要的答案。至于在论坛论坛求助，就要看你RP了。</p>
<h3 class="subtitle">提前预防——看清楚IE、Mozilla下的CSS支持</h3>
<p>最踏实的方法就是在此之前就熟悉CSS在主流浏览器里的支持情况，有时候拿着CSS手册看，看到里面说的属性或选择赴多么多么的NB，结果没一个浏览器支持。这方面的讯息网络上已经积累了不少：</p>
<ul>
<li><a href="http://blogs.msdn.com/ie/archive/2006/08/22/712830.aspx">IE7的官方BLOG</a>，总结了IE7的CSS修正和已知错误</li>
<li><a href="http://www.positioniseverything.net/">PIE-Position is Everything</a>，IE6时代就存在的怨念群体，总结了很多IE的错误以及解决方案</li>
<li>也许你没有想到，<a href="http://developer.mozilla.org/en/docs/CSS_Reference:Mozilla_Extensions">Mozilla有专有属性</a>，可能在兼容性问题上你会用到</li>
<li><a href="http://www.communitymx.com/content/article.cfm?cid=C37E0&amp;print=true">分析显示问题的好文章</a></li>
</ul>
<h3 class="subtitle">乖孩子的做法——有时间多读读书</h3>
<p>如果你有幸从头到尾读下任何一本XHTML教程，你写出来的叶子就算无法正常显示，你也可以问心无愧。写书的，再菜也是这方面有过研究的学者。当然有一本好教材，那才叫如虎添翼。<br />
这方面的书籍，基本没有悬念的指向O‘Reilly出版社，就两本：《XHTML权威指南》6TH Edition（EN）5TH Edition（CN）、《CSS权威指南》1ST Edition（CN）2ND Edition（EN）。第二本书的有第三版，但是改动不大，而且只有英文版，不必求新。这些书EM上可以拖到，临时解馋，拥有一本实体书才是最重要的。CSS方面还有一本一定有的书，电子版的<a href="http://www.rainersu.com/download/css20.chm">CSS2手册</a>。<br />
另外最让人想不到的一点是<a href="http://www.w3.org/TR/CSS21/indexlist.html">W3C文档</a>，那上面很多东西都是宝!</p>
<h3 class="subtitle">坏孩子的做法——我用hack我怕谁</h3>
<p>一般来说是不推荐hack的，但是hack用起来真的很方便，而且如果真的成功了有种解脱了的感觉&#8230;&#8230;汗~下面是我保存下的hack资源：</p>
<ul>
<li><a href="http://bbs.blueidea.com/thread-2558268-1-1.html">IE7的!important hack</a></li>
<li><a href="http://andymao.com/andy/post/76.html">少量CSS Hack </a></li>
<li><a href="http://www.w3cn.org/article/tips/2006/120.html">CSS Hack图表</a></li>
</ul>
<h3 class="subtitle">做个细心人——关注页面可访问性</h3>
<p>很多时候就算一般浏览器显示正常，也不意味着所有浏览者都能正常阅读。可访问性——这是一个很大的课题，有的人会研究得很BT，往往也和SEO挂上钩，有时候读别人的文章，我会头晕。对于一般网站，我觉得能做到如下一些就好，其他事情可以自行Google：</p>
<ul>
<li>选择合适的DOCTYPE</li>
<li>标记恰当的语言</li>
<li>构建具有意义并且独特的标题</li>
<li>提供完整的导航工具</li>
<li>把你的主要内容提前</li>
<li>理性地使用颜色</li>
<li>使用真实链接</li>
<li>将链接写上title属性，图片上写上alt属性</li>
<li>设置键盘快捷方式</li>
<li>不要打开新窗口</li>
<li>学会使用arconyms</li>
<li>表格头TD标签如果要加粗，请换Caption</li>
<li>别为了布局而用spacer imgaes</li>
<li>使用水平标尺</li>
<li>恰当使用Header</li>
<li>用label标签组织表单</li>
<li>为每个页面提供搜索选项</li>
</ul>
<p>如果通过以上途径都没有改善问题，那么你能做的只有两件事情：</p>
<ol>
<li>更换你的思路，实现另一种效果</li>
<li>等待hack或浏览器更新</li>
</ol>
<p>Let&#8217;s Fvck That Page</p>
]]></content:encoded>
			<wfw:commentRss>http://pagetalks.com/2008/08/29/how-to-fvck-that-page.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
