CSS模板2
你知道什么遥不可及吗?记住并且填入所有CSS选择器恰当的性质(property,又译特性,属性)。留意我大部分的项目,我一遍又一遍地为选择器使用相同的性质。所以我创建另外一个基于CSS模板1的模板,在里面为所有CSS选择器添加经常会用的CSS性质。以下是CSS模板2的样例:
/* ----- CSS ----- */ *{ margin:; padding:; font-family:; font-size:; } body{ margin:; padding:; background:; } /* ----- IDS ----- */ #container{ width:; margin:; padding:; background:; text-align:; } #primaryContent{ position:; float:; width:; margin:; padding:; background:; text-align:; } /* ----- CLASSES ----- */ .hide{ display:none; } .show{ display:block; } /* ----- PARAGRAPHS ----- */ p{ font:; color:; font-size:; font-family:; font-style:; font-weight:; font-variant:; text-align:; text-indent:; text-decoration:; text-shadow:; text-transform:; letter-spacing:; word-spacing:; } /* ----- LISTS ----- */ li{ listy-style:; list-style-type:; list-style-image:; list-style-position:; float:; margin:; padding:; } /* ----- LINKS ----- */ a{ font:; color:; text-decoration:; border-bottom:; } a:hover{ color:; background-color:; border-bottom:; } a:visited, a:active, a:focus{ color:; background-color:; border-bottom:; }
很好,你已经有所斩获。需要注意的是,我也加入了通用选择器(shorthand selectors)如font和list-style取代与之相应的独个性质。这可以在设计和开发阶段有更多选择。
HTML标记模板
但是没有XHTML标记来示范,这些CSS选择器和性质能有什么好处呢?XHTML模板是我的web设计的Lorem Ipsum。以下是来自该模板的示例:
<div id="container"> <h1><a href="" title="Test Link">Untitled</a> - Online Style Guide Template (h1)</h1> <p>Title : <em>Title of this Document</em><br /> Description : <em>A description of this document that explains how this guide should be used.</em></p> <p>Author : <em>The Author</em><br /> URL: <em>http://url.to.reference.com</em><br /></p> <p>Created : <em>Month DD, YYYY</em><br /> Modified : <em>Month DD, YYYY</em><br /></p> <hr /> <div id="navigation"> <h2>Navigation (h2)</h2> <ul> <li>Unordered List - First item.</li> <li>Another item with <a href="" title="Test Link">a link.</a></li> <li><a href="" title="Test Link">Another item that is linked</a></li> <li>Last item.</li> </ul> <ol> <li>Ordered List - First item.</li> <li>Another item with <a href="" title="Test Link">a link.</a></li> <li><a href="" title="Test Link">Another item that is linked.</a></li> <li>Last item.</li> </ol> </div><!-- navigation --> <hr /> <div id="primaryContent"> <h2>Primary Content (h2)</h2> <h3>Headline the Third (h3)</h3> <h4>Headline the Fourth (h4)</h4> <p>First paragraph. In <a href="" title="Test Link">typography</a>, a paragraph is a block of text. Paragraphs are the medium-size unit of <a href="" title="Test Link">human-language text</a>. A group of sentences developing a single idea from a topic sentence. Some words in sentences need to be <b>bolded</b>, <i>italicized</i>, <strong>strengthened</strong> or <em>emphasized</em>.</p> <p>Another paragraph. In typography, a paragraph is a block of text. Paragraphs are the medium-size unit of human-language text. A group of sentences developing a single idea from a topic sentence.</p> <ul> <li>Unordered List - First item.</li> <li>Another item with <a href="" title="Test Link">a link.</a></li> <li><a href="" title="">Another item that is linked</a></li> <li>Last item.</li> </ul> <ol> <li>Ordered List - First item.</li> <li>Another item with <a href="" title="Test Link">a link.</a></li> <li><a href="" title="Test Link">Another item that is linked.</a></li> <li>Last item.</li> </ol>
需要注意的是该模板缺少图像元素的例子。因为这些元素都是外部文件,视情况存在,我更喜欢逐个包含他们。
在线样式指南模板
如果你像我一样并且有打印设计的背景,你将很快看到这个模板的价值所在。样式指南十分方便一个设计和开发团队交流和阐明设计要点。
该模板基本上是所有模板集合的一个页面。这个在线样式指南模板很大程度减少创建外部标记规则集的时间。如果你使用Firefox并且安装了Web Developer Toolbar,我强烈推荐你在使用“Edit CSS“编辑CSS,观察页面的变化。编辑完毕,保存已经修改过的CSS到外部文件去,并且更新相应的HTML标记。这就像一个高级的CSS编辑器,还是免费的。
该模板还可以让我安全地测试实验性的CSS设计,查看其如何影响同一页面的其他元素和性质。
总结
创建这些模板的一个最大好处是教会了我很多隐藏在XHTML和CSS背后的细节。我学习了我以前从不会考虑使用的元素,选择器和性质,因而也创建了这些模板。所以这些模板不仅让我设计得更快,而且让我设计得更好。
显然,每个不同的设计者和开发者有自己不同的工作方式。使用XHTML和CSS模板可能并不适合你用来开始一个web项目。我只知道,这是我的工作方式,而且大大地帮助了我。此外,我认为有东西可填入比仅仅打开一个空白文档的工作效率高得多。动力能量可不小。
如果你喜欢,别担心,利用这些模板并且引入你的工作流程中去吧。
原文:Quick Start Your Design with XHTML Templates,Kevin Hale,Particletree
出处:Realazy
责任编辑:moby
上一页 使用模板快速启动你的设计 [1] 下一页
◎进入论坛网站综合、网页制作版块参加讨论
|