Loading...
  所在位置:论坛首页 -> ┈┋电脑网络技术区┋┈ -> 网页制作技术 -> 第二步:创建html模板及文件目录等
标题:第二步:创建html模板及文件目录等收藏 编辑 删除 楼主 | 上一篇 下一篇
爱死你了杏
等级:大侠
权限:普通用户
积分:130
金钱:3610
声望:198
经验:185
发帖数:956
注册:2007年11月26日
资料 短消息2008-7-6 21:40:22
1.创建html模板。
  代码如下:

Example Source Code [www.52CSS.com] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
<title>CompanyName - PageName</title>
<meta http-equiv="Content-Language" content="en-us" /> 
<meta http-equiv="imagetoolbar" content="no" />
<meta name="MSSmartTagsPreventParsing" content="true" /> 
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" /> 
<meta name="author" content="Enlighten Designs" />
<style type="text/CSS" media="all">@import "CSS/master.CSS";</style>
</head>
<body>
</body>
</html>
  将其保存为index.html,并创建文件夹CSS,images,网站结构如下:



2.创建网站的大框:
  建立一个宽760px的盒子,它将包含网站的所有元素。
  在html文件的<body>和</body>之间写入

Example Source Code [www.52CSS.com] <div id="page-container">
Hello world.
</div>
  创建CSS文件,命名为master.CSS,保存在/CSS/文件夹下。写入:

Example Source Code [www.52CSS.com] #page-container {
width: 760px;
background: red;
}
  控制html的id为page-container的盒子的宽为760px,背景为红色。

  现在为了让盒子居中,写入margin: auto;,使CSS文件为:

Example Source Code [www.52CSS.com] #page-container {
width: 760px;
margin: auto;
background: red;
}
  现在你可以看到盒子和浏览器的顶端有8px宽的空隙。这是由于浏览器的默认的填充和边界造成的。消除这个空隙,就需要在CSS文件中写入:

Example Source Code [www.52CSS.com] html, body {
margin: 0;
padding: 0;
}

2008-7-6 21:40:22 顶部
第1页 共页 共0个回复     <<    >>    
 快速回复
  • 支持UBB,HTML标签

  • 高级回复

  • 操作选项:评分 加精 解精 奖惩 设专题 设公告 解公告 固顶 总固顶 解固顶 结帖 解结帖 锁帖 解锁 移帖 删帖
      首页 | 购买指南 | 商业版本 | 虚拟主机 | 特色介绍 | 下载中心 | 支付方式
    Copyright 2004-2008 BBSGood.com Powered By: BBSGood.Speed Version 5.0
      咨询电话:0575-85513832、0575-85513825(传真)、7*24小时咨询服务:13606552007 不良信息举报中心 浙ICP备05029817号
      业务QQ:38958768、客服QQ1:415896239、客服QQ2:343896043、MSN:jccsxx@hotmail.com