老师请检查,代码有没有错?标签嵌套有没有问题?

来源:3-8 自由编程

精慕门8110630

2021-01-23 16:09:55

相关代码:

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Career Builder</title>
</head>

<body>
<!-- 网页的头部 -->
<header>
<!-- 网页的logo -->
<div class="logo">
<img src="images/logo.png" alt="">
</div>

<!-- 网页的导航区 -->
<div class="nav">
<ul>
<li><a href="">HOME</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">GALLERY</a></li>
<li><a href="">FACULTY</a></li>
<li><a href="">EVENTS</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</div>

</header>

<!-- 网页的banner -->
<div class="banner">
<!-- banner图片 -->
<div class="banner-images">
<img src="images/banner3.jpg" alt="">
</div>

<!-- banner遮罩层 -->
<div class="mask-layer">
<span>banner遮罩层</span>
</div>

<!-- banner表单 -->
<div class="form">
<span>banner表单</span>
</div>

</div>

<!-- 网页的about部分 -->
<div class="about">
<!-- 标题和简短描述区域 -->
<div class="title-and-short-description">
<h2>ABOUT</h2>
<!-- 分割线 -->
<div>
<p>分割线</p>
</div>
<span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s.</span>
</div>

<!-- 详细描述部分 -->
<div class="detailed-description">
<h2>A WORD ABOUT US</h2>
<span>Praesent dignissim viverra est, sed bibendum ligula congue non. Sed ac nisl et felis gravida commodo?
Suspendisse eget ullamcorper ipsum. Suspendisse diam amet.</span>
<p>
<a href="">EXPLORE</a>
</p>
<p>
<img src="images/bb3.jpg" alt="">
</p>
<div>
<p>70000</p>
<span>分割线</span><br>
<span>Students</span>
</div>
<div>
<p>600</p>
<span>分割线</span><br>
<span>Faculty</span>
</div>
</div>
</div>

<!-- 网页的图文混排区域 -->
<section class="photo-text">
<div class="part1">
<img src="images/b1.jpg" alt="">
<h3>Library</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.</p>
<a href="">
EXPLORE
</a>
</div>
<div class="part2">
<img src="images/b2.jpg" alt="">
<h3>Library</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.</p>
<a href="">
EXPLORE
</a>
</div>

<div class="part3">
<h3>Library</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.</p>
<a href="">
EXPLORE
</a><br>
<img src="images/b3.jpg" alt="">
</div>

<div class="part4">
<h3>Library</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer
took a galley of type and scrambled it to make a type specimen book.</p>
<a href="">
EXPLORE
</a><br>
<img src="images/b4.jpg" alt="">
</div>
</section>

<!-- 网页的gallery区域 -->
<div class="gallery">
<!-- 标题和简短描述区域 -->
<div class="title-and-short-description">
<h2>GALLERY</h2>
<P>分割线</P>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s.</p>
</div>

<!-- gallery详细信息区 -->
<section class="detailed-description">
<dl>
<dt>
<img src="images/03-01.jpg" alt="">
</dt>
<dd>Science Lab</dd>
<dt>
<img src="images/03-02.jpg" alt="">
</dt>
<dd>Indoor Stadium</dd>
<dt>
<img src="images/03-03.jpg" alt="">
</dt>
<dd>Transportation</dd>
<dt>
<img src="images/03-04.jpg" alt="">
</dt>
<dd>Kids Room</dd>
<dt>
<img src="images/03-05.jpg" alt="">
</dt>
<dd>Meditation Classes</dd>
<dt>
<img src="images/03-06.jpg" alt="">
</dt>
<dd>Kids Play Ground</dd>
</dl>
</section>
</div>

<!-- 网页页脚 -->
<div class="footer">
<P>&copy; 2016 imooc.com 京ICP备13046642号</P>
</div>
</body>


写回答

1回答

好帮手慕夭夭

2021-01-23

同学你好,标签嵌套的没有不规范的,不过结构上可以如下优化:

1、div是用来划分每一个区域的,像如下about区域中间部分,分成了左中右三部分,所以每一部分放在div中,结构更好。

http://img.mukewang.com/climg/600bf0a409f1a14d06600215.jpg

代码如下修改:

http://img.mukewang.com/climg/600bf19009552d8508270505.jpg

同学以后再去做页面的时候,可以多考虑一下布局,例如一个页面先划分主体区域(头部,内容,尾部等),而每一个大区域中,可以再划分的更细一点。这样会让我们的html结构看起来更加的清晰,更便于阅读和维护哦。

2、gallery区域中,把所有的列表放在了一个dl中。这里是6个不同的列表,建议放在6个dl中更好。这里老师就不示范了,自己改一下哦

http://img.mukewang.com/climg/600bf270094657ae04850511.jpg

祝学习愉快~



0

0 学习 · 15276 问题

查看课程