学习网考试学习资料

Gzu521.com

Web设计中关于首页代码一些规范写法

HTML教程   点击:次   发布时间:2005-9-12   【字体: 】   来源:Gzu521.com
Gzu521.com我的学习网
首页的代码关键在head区,head区是指首页html代码的<head>和</head>之间的内容。 

head区必须加入的标识

公司版权注释 <!--- the site is designed by yourcompany,inc 03/2001 ---> 

网页显示字符集 例如:
简体中文:<meta http-equiv="content-type" content="text/html; charset=gb2312">
繁体中文:<meta http-equiv="content-type" content="text/html; charset=big5">
英 语:<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">


原始制作者信息 <meta name="author" content="webmaster@yoursite.com"> 

网站简介 <meta name="description" content="这里填您网站的简介"> 

搜索关键字 <meta name="keywords" content="关键字1,关键字2,关键字3,..."> 

网页的CSS规范 <link href="style/style.css" rel="stylesheet" type="text/css"> 

网页标题 <title>这里是你的网页标题</title> 

head区可以选择加入的标识 

设定网页的到期时间。一旦网页过期,必须到服务器上重新调阅。
<meta http-equiv="expires" content="wed, 26 feb 1997 08:21:57 gmt"> 

禁止浏览器从本地机的缓存中调阅页面内容。
<meta http-equiv="pragma" content="no-cache"> 

用来防止别人在框架里调用你的页面。
<meta http-equiv="window-target" content="_top"> 

自动跳转。
<meta http-equiv="refresh" content="5;url=http://www.yahoo.com">
5指时间停留5秒。 

网页搜索机器人向导.用来告诉搜索机器人哪些页面需要索引,哪些页面不需要索引。
<meta name="robots" content="none">
content的参数有all,none,index,noindex,follow,nofollow。默认是all。 

收藏夹图标
<link rel = "shortcut icon" href="favicon.ico"> 

js调用规范

所有的Javascript脚本尽量采取外部调用
<script language="JavaScript" src="script/xxxxx.js"></script> 

css书写规范

所有的css的尽量采用外部调用
<link href="style/style.css" rel="stylesheet" type="text/css"> 

书写时重定义的最先,伪类其次,自定义最后(其中a:link a:visited a:hover a:actived 要按照顺序写)便于自己和他人阅读。 

为了保证不同浏览器上字号保持一致,字号建议用点数pt和像素px来定义,pt一般使用中文宋体的9pt和11pt,px一般使用中文宋体12px 和14.7px 这是经过优化的字号,黑体字或者宋体字加粗时,一般选用11pt和14.7px 的字号比较合适。 

css推荐模板。 

<style type="text/css"> 
<!— 
p { text-indent: 2em; } 
body  { font-family: "宋体"; font-size: 9pt; color: #000000; margin-top: 0px;  margin-right: 0px; margin-bottom: 0px; margin-left: 0px} 
table { font-family: "宋体"; font-size: 9pt; line-height: 20px; color: #000000} 
a:link { font-size: 9pt; color: #0000ff; text-decoration: none} 
a:visited { font-size: 9pt; color: #990099; text-decoration: none} 
a:hover { font-size: 9pt; color: #ff9900; text-decoration: none} 
a:active { font-size: 9pt; color: #ff9900; text-decoration: none} 
a.1:link { font-size: 9pt; color: #3366cc; text-decoration: none} 
a.1:visited { font-size: 9pt; color: #3366cc; text-decoration: none} 
a.1:hover { font-size: 9pt; color: #ff9900; text-decoration: none} 
a.1:active { font-size: 9pt; color: #ff9900; text-decoration: none} 
.blue { font-family: "宋体"; font-size: 10.5pt; line-height: 20px; color: #0099ff; letter-spacing: 5em} 
--> 
</style> 

body标识

为了保证浏览器的兼容性,必须设置页面背景<body bgcolor="#ffffff">

责任编辑:gzu521

网页设计分类
HTML教程
CSS教程
Javascript教程
Dreamweaver教程
FrontPages教程
FireWorks教程
Flash教程
PhotoShop教程
建站知识
分类推荐信息
更多...
大类最新文章
更多...