蓝桥为了帮助大家学习,开发了一个知识汇总网站,现在想设计一个简单美观的首页。本题请根据要求来完成一个首页布局。
开始答题前,需要先打开本题的项目代码文件夹,目录结构如下:
├── css
│ └── style.css
├── data.txt
├── index.html
└── mark.png
其中:
css/style.css
是样式文件。data.txt
是页面数据文件。index.html
是主页面。mark.png
是页面参数标注图。注意:打开环境后发现缺少项目代码,请手动键入下述命令进行下载:
cd /home/project
wget https://labfile.oss.aliyuncs.com/courses/9791/06.zip && unzip 06.zip && rm 06.zip
请根据
mark.png
图片上的参数标注,补充css/style.css
和index.html
文件中的代码。对于 mark.png 上未标注的参数,请结合效果图自行调整。 页面版心宽度为1024px
,请保证版心居中,让页面呈现如下图所示的效果: 请根据mark.png
图片上的参数标注,补充css/style.css
和index.html
文件中的代码。对于 mark.png 上未标注的参数,请结合效果图自行调整。 页面版心宽度为1024px
,请保证版心居中,让页面呈现如下图所示的效果:
页面数据在 data.txt
文件中,直接复制即可。
data.txt
所提供的页面数据。/*
TODO:请补充代码
*/
.one{
background-color: #a6b1e1;
height: 486px;
display: flex;
justify-content: center;
}
#one{
width: 1024px;
/* border: 1px gray solid; */
}
nav{
margin-top: 13px;
height: 46px;
/* border: 1px gray solid; */
}
nav ul{
/* border: 1px red solid; */
display: flex;
color: white;
/* gap:16px; */
}
nav ul li:first-child{
/* border: 1px gray solid; */
font-size: 18px;
margin-right: 365px;
}
nav ul li:nth-child(n+2){
font-size: 16px;
margin-right: 16px;
}
.tit div{
font-size: 45px;
color: black;
/* border: 1px gray solid; */
}
.tit{
/* border: 1px gray solid; */
display: flex;
justify-content: center;
margin-top: 30px;
}
.des div{
font-size: 21px;
color: white;
font-weight: 200;
/* border: 1px gray solid; */
}
.des{
/* border: 1px gray solid; */
display: flex;
justify-content: center;
margin-top: 62px;
}
button{
background-color: transparent;
box-shadow: inset 0 0 0 2px #efbfbf;
border: #efbfbf 0.1px solid;
border-radius: 2px;
}
button div{
font-size: 18px;
background-color: transparent;
color: #efbfbf;
padding: 10px;
/* box-shadow: inset 0 0 0 2px #efbfbf; */
}
.join{
display: flex;
justify-content: center;
margin-top: 36px;
/* border: 1px gray solid; */
}
.two{
/* border: 1px red solid; */
height: 376px;
display: flex;
justify-content: center;
}
#two{
margin-top: 74px;
width: 1024px;
/* border: 1px gray solid; */
}
table{
height: 144px;
}
th{
font-size: 30px;
color: black;
font-weight: 200;
text-align: left;
}
td{
font-size: 18px;
color: #aaa;
line-height: 1.4em;
width: 502px;
vertical-align: top;
}
tbody tr td:first-child{
padding-right: 20px;
}
footer{
height: 80px;
border-top: 1px #aaa solid;
display: flex;
justify-content: center;
}
#three{
width: 1024px;
}
.z1 div{
font-size: 14px;
color: #aaa;
}
.z1{
display: flex;
justify-content: center;
margin-top: 30px;
}
.z2 div{
font-size: 14px;
color: #aaa;
}
.z2{
display: flex;
justify-content: center;
margin-top: 10px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>蓝桥知识网</title>
<link rel="stylesheet" href="./css/style.css" />
</head>
<body>
<!--TODO:请补充代码-->
<div class="one">
<div id="one">
<nav>
<ul type="none">
<li>蓝桥知识网</li>
<li>首页</li>
<li>热门技术</li>
<li>使用手册</li>
<li>知识库</li>
<li>练习题</li>
<li>联系我们</li>
<li>更多</li>
</ul>
</nav>
<div class="tit">
<div>蓝桥云课</div>
</div>
<div class="des">
<div>随时随地丰富你的技术栈!</div>
</div>
<div class="join">
<button>
<div>加入我们</div>
</button>
</div>
</div>
</div>
<div class="two">
<div id="two">
<table>
<thead>
<tr>
<th>人工智能</th>
<th>前端开发</th>
</tr>
</thead>
<tbody>
<tr>
<td>人工智能亦称智械、机器智能,指由人制造出来的机器所表现出来的智能。通常人工智能是指通过普通计算机程序来呈现人类智能的技术。</td>
<td>前端开发是创建 WEB 页面或 APP 等前端界面呈现给用户的过程,通过 HTML,CSS 及 JavaScript 以及衍生出来的各种技术、框架、解决方案,来实现互联网产品的用户界面交互。</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th>后端开发</th>
<th>信息安全</th>
</tr>
</thead>
<tbody>
<tr>
<td>后端开发是实现页面的交互逻辑,通过使用后端语言来实现页面的操作功能,例如登录、注册等。</td>
<td>ISO(国际标准化组织)的定义为:为数据处理系统建立和采用的技术、管理上的安全保护,为的是保护计算机硬件、软件、数据不因偶然和恶意的原因而遭到破坏、更改和泄露。</td>
</tr>
</tbody>
</table>
</div>
</div>
<footer>
<div id="three">
<div class="z1">
<div>© 蓝桥云课 2022</div>
</div>
<div class="z2">
<div>京公网安备 11010102005690 号 | 京 ICP 备 2021029920 号</div>
</div>
</div>
</footer>
</body>
</html>
<!DOCTYPE html>
:声明这是一个 HTML5 文档。<html>
标签:文档的根元素。<head>
部分:包含元数据和链接到外部样式表的信息。 <meta charset="utf-8">
:设置字符编码为 UTF-8。<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
:设置视口,确保页面在不同设备上正确显示,禁止用户缩放。<title>蓝桥知识网</title>
:设置页面标题。<link rel="stylesheet" href="./css/style.css">
:链接到外部 CSS 文件,用于样式化页面。<body>
部分:包含页面的实际内容。 .one
类的 div
:页面的上半部分,包含导航栏、标题、描述和按钮。 nav
元素:导航栏,包含一个无序列表,列出了网站的主要导航项。.tit
类的 div
:显示标题 “蓝桥云课”。.des
类的 div
:显示描述文本 “随时随地丰富你的技术栈!”。.join
类的 div
:包含一个按钮,显示 “加入我们”。.two
类的 div
:页面的中间部分,包含两个表格,分别介绍不同的技术领域。footer
元素:页面的页脚部分,包含版权信息和备案号。.one{
background-color: #a6b1e1;
height: 486px;
display: flex;
justify-content: center;
}
#one{
width: 1024px;
/* border: 1px gray solid; */
}
nav{
margin-top: 13px;
height: 46px;
/* border: 1px gray solid; */
}
nav ul{
/* border: 1px red solid; */
display: flex;
color: white;
/* gap:16px; */
}
nav ul li:first-child{
/* border: 1px gray solid; */
font-size: 18px;
margin-right: 365px;
}
nav ul li:nth-child(n+2){
font-size: 16px;
margin-right: 16px;
}
.tit div{
font-size: 45px;
color: black;
/* border: 1px gray solid; */
}
.tit{
/* border: 1px gray solid; */
display: flex;
justify-content: center;
margin-top: 30px;
}
.des div{
font-size: 21px;
color: white;
font-weight: 200;
/* border: 1px gray solid; */
}
.des{
/* border: 1px gray solid; */
display: flex;
justify-content: center;
margin-top: 62px;
}
button{
background-color: transparent;
box-shadow: inset 0 0 0 2px #efbfbf;
border: #efbfbf 0.1px solid;
border-radius: 2px;
}
button div{
font-size: 18px;
background-color: transparent;
color: #efbfbf;
padding: 10px;
/* box-shadow: inset 0 0 0 2px #efbfbf; */
}
.join{
display: flex;
justify-content: center;
margin-top: 36px;
/* border: 1px gray solid; */
}
.two{
/* border: 1px red solid; */
height: 376px;
display: flex;
justify-content: center;
}
#two{
margin-top: 74px;
width: 1024px;
/* border: 1px gray solid; */
}
table{
height: 144px;
}
th{
font-size: 30px;
color: black;
font-weight: 200;
text-align: left;
}
td{
font-size: 18px;
color: #aaa;
line-height: 1.4em;
width: 502px;
vertical-align: top;
}
tbody tr td:first-child{
padding-right: 20px;
}
footer{
height: 80px;
border-top: 1px #aaa solid;
display: flex;
justify-content: center;
}
#three{
width: 1024px;
}
.z1 div{
font-size: 14px;
color: #aaa;
}
.z1{
display: flex;
justify-content: center;
margin-top: 30px;
}
.z2 div{
font-size: 14px;
color: #aaa;
}
.z2{
display: flex;
justify-content: center;
margin-top: 10px;
}
.one
类:设置背景颜色、高度,并使用 flex 布局将内容居中。#one
ID:设置宽度。nav
元素:设置上边距和高度。nav ul
:将导航项列表设置为 flex 布局,并设置文字颜色。nav ul li:first-child
:设置第一个导航项(网站名称)的字体大小和右边距。nav ul li:nth-child(n+2)
:设置其他导航项的字体大小和右边距。.tit div
:设置标题的字体大小和颜色。.tit
类:使用 flex 布局将标题居中,并设置上边距。.des div
:设置描述文本的字体大小、颜色和字体权重。.des
类:使用 flex 布局将描述文本居中,并设置上边距。button
元素:设置按钮的背景颜色、边框样式和圆角。button div
:设置按钮内文本的字体大小、背景颜色和颜色,并添加内边距。.join
类:使用 flex 布局将按钮居中,并设置上边距。.two
类:设置高度,并使用 flex 布局将内容居中。#two
ID:设置宽度和上边距。table
元素:设置高度。th
元素:设置表头单元格的字体大小、颜色、字体权重和文本对齐方式。td
元素:设置表格数据单元格的字体大小、颜色、行高、宽度和垂直对齐方式。tbody tr td:first-child
:设置第一个数据单元格的右边距。footer
元素:设置高度、上边框样式,并使用 flex 布局将内容居中。#three
ID:设置宽度。.z1 div
和 .z2 div
:设置页脚文本的字体大小和颜色。.z1
和 .z2
类:使用 flex 布局将页脚文本居中,并设置上边距。三、工作流程▶️
<link rel="stylesheet" href="./css/style.css">
找到并加载外部 CSS 文件,解析其中的样式规则。