手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

HTML基本布局

时间:2024-10-12 08:45:11

1、新建一个HTML文档,如图所示

HTML基本布局
HTML基本布局

2、定义页眉,页脚,侧边栏和内容,在body标签里输入<div class=""> <div id=&鳎溻趄酃quot;">页眉</div> <div class="">侧边栏</div> <div class="">主内容</div> <div id="">页脚</div></div>如图所示

HTML基本布局

3、然后定义他们的id和class,如图所示

HTML基本布局

4、然后在head标签里定义css文件,如图所示

HTML基本布局

5、编写全体输入* { margin: 0; padding: 0;}如图所示

HTML基本布局

6、编辑定位整体,输入.wrapper { width: 960px; margin-left: auto; 罪焐芡拂margin-right: auto; color: #fff; font-size: 30px; text-align: center;}如图所示

HTML基本布局

7、编写页眉,输入#header { height: 100px; background: #38382e; margin-bottom: 10px;}

HTML基本布局

8、编写页脚。输入#footer { background: #cc4ad5; height: 100px; text-align: center; clear: both;}

HTML基本布局

9、编写侧边栏,输入.sidebar { float: left; width砜实蛰斓: 220px; margin-rig茑霁酌绡ht: 20px; margin-bottom: 10px; height: 300px; background: #5d33cf;}

HTML基本布局

10、编写内容部分,输入.content { float: left; width: 720px; height: 300px; background: #c8ca30; margin-bottom: 10px;}

HTML基本布局

11、最后按f12预览即可

HTML基本布局
© 手抄报圈