分享
 
 
 

使用模板快速启动你的设计

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

引言

现在,我要想您介绍一些工作流程中帮我开始新的web开发项目的模板。除了XHTML模板外,我还列出了一些已经帮我为多种网站建立样式指南的CSS模板和XHTML样例。

很早之前,下面这个模板或者叫指引的东西出现在head区。

<html>

<head>

<title></title>

</head>

<body>

</body>

</html>

啊,那真是一个美好的时代啊。然而,现在的世界越来越复杂,当上面的大纲用作HTML 101教程时,追随web标准当代潮流的web开发者需要更多更多的代码用以开发适当web页面。

实际上,对于一个设计者来说,入门HTML标记是最花费时间的任务之一。灵感?容易。Multiple comps?没有问题。但记住所有不同的配置样式的CSS选择器(selector)却是不那么容易。

尽管如此,在我变聪明之前,我使用定制的CSS和XHTML模板的时候发现,我打开先前项目仅仅是一遍又一遍地回答这些问题:我该怎么样包含一个外部的JavaScript文件?该如何编写meta标记?在CSS文件里怎么样注释才好?构建表单的最佳方法是什么?我的朋友,是时候终结低效率的动作了。我们开始吧。

文件

XHTML模板1

XHTML模板2 CSS模板1

CSS模板2

XHTML标记模板 在线样式指南模板

注意:这是译者修改过的文件,加入少量的翻译说明。下载原版请到Particletree。

XHTML模板1

XHTML页面的头部区域就像医生办公室里的写字板——预备性的文本工作。下面这个模板着重于兼容和完整的头部结构。除了选择doctype,余下你只需要填空。

<!-- Doctype : Choose one and delete this comment -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"

"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>

</title>

<!-- Meta Tags -->

<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />

<meta name="robots" content="index, follow" />

<meta name="description" content="" />

<meta name="keywords" content="" />

<meta name="author" content="" />

<!-- Favicon -->

<link rel="shortcut icon" href="" />

<!-- CSS : Include and embedded versions-->

<link rel="stylesheet" href="" media="screen,projection" type="text/css" />

<link rel="stylesheet" href="" media="print" type="text/css" />

<!-- RSS -->

<link rel="alternate" href="" title="RSS Feed" type="application/rss+xml" />

<!-- JavaScript -->

<script src="" type="text/javascript"></script>

</head>

XHTML模板2

模板1对于理解需要填入何种信息十分有用,但不利于快速开发和样式化因为附上了.css和.js文件。这意味着我必须得建立2个以上的文件来控制一个页面的行为(behavior)和样式。当我在最后期限或者仅仅一个页面中干活时,管理三个文件是不必要的负担。在头部添加嵌入的CSS和JavaScript区段让我可以马上开工。为避免重复展示整个模板,我只给你展示修改部分(完整部分请看模板文件):

<!-- CSS : Include and embedded versions-->

<link rel="stylesheet" href="" media="screen,projection" type="text/css" />

<link rel="stylesheet" href="" media="print" type="text/css" />

<style type="text/css">

<!--

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Title :

Author :

URL :

Description :

Created :

Modified :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* ----- CSS ----- */

-->

</style>

修改的CSS部分

<!-- CSS : Include and embedded versions-->

<link rel="stylesheet" href="" media="screen,projection" type="text/css" />

<link rel="stylesheet" href="" media="print" type="text/css" />

<style type="text/css">

<!--

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Title :

Author :

URL :

Description :

Created :

Modified :

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* ----- CSS ----- */

-->

</style>

修改的JavaScript部分

<!-- JavaScript : Include and embedded version -->

<script src="" type="text/javascript"></script>

<script type="text/javascript">

<!--

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

//

// Title :

// Author :

// URL :

// // Description :

// // Created :

// Modified :

// // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

// JavaScript

window.onload = function(){}

//-->

</script>

这些嵌入的部分同时让我不至于忘记正确的编写.js和.css文件。现在没有借口了,因为这实在很容易。JavaScript部分包含了一个window.onload的空函数,以备有时运行页面载入脚本之需。当一切运行良好时,如果需要恰当的文件管理,我只需要把CSS和JavaScript拷贝到外部文件去。

CSS模板1

如果我知道正在干着的网站会有大块大块的CSS来袭,我喜欢使用下面这个有几分类似飞机起飞前检查清单的模板,它确保我可以顾及所有基本的选择器。假使一个页面的不同区域的同一组选择器(比如无序列表)要使用不同的样式,我只需拷贝粘贴,并加上恰当的id和class。没有用到的话,我只需删掉。以下是CSS模板1的样例:

/* ----- IDS ----- */

#container{

}

#primaryContent{

}

#secondaryContent{

}

#navigation{

}

#footer{

}

/* ----- CLASSES ----- */

.hide{

}

.show{

}

/* ----- HEADINGS ----- */

h1{

}

h2{

}

h3{

}

h4{

}

/* ----- LISTS ----- */ li{

}

li p{

}

ol{

}

ul{

}

ol li{

}

ul li{

}

/* ----- IMAGES ----- */

img{

}

img a{

}

img a:hover{

}

/* ----- LINKS ----- */

a{

}

a:hover{

}

a:visited, a:active, a:focus{

}

a:visited{

}

a:active{

}

a:focus{

}

/* ----- FORMS ----- */

form{

}

fieldset{

}

legend{

}

label{

}

input{

}

textarea{

}

input, textarea{

}

select{

}

optgroup{

}

option{

}

/* ----- TABLES ----- */

table{

}

caption{

}

thead{

}

tbody{

}

tfoot{

}

tr{

}

tr .alt{

}

th{

}

td{

}

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 a

[1] [2] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有