辛苦老师再为我在检查一下作业啦

来源:4-4 自由编程

qq_慕仰20210716

2021-07-31 21:17:34

* {

  margin0;

  padding0;

}

header {

  width100%;

  height80px;

  background-color#07cbc9;

}

header .head2 {

  width1200px;

  height80px;

  /* 这个地方,logo的img和nav有一起的head2,所以让head2 水平居中在header里即可,上下撑满了,所有自动即为水平居中 */

  margin0 auto;

}

header .head2 .logo {

  floatleft;

  padding16px 0;

}

/* img有默认的间隙,会撑大父级的高度,建议将img转换为块元素清除间隙 ,这个我没发现有*/

header .head2 .logo img{

  displayblock;

}

/* nav和ul的宽度不用设置,由内容撑开 */

header .head2 nav {

  floatright;


  height80px;

}

header .head2 nav ul {

  list-stylenone;

  height80px;

}

header .head2 nav ul li {

  floatleft;

  margin-right20px;

}

header .head2 nav ul li a {

  displayinline-block;

  text-decorationnone;

  height80px;

  colorwhite;

  padding0 10px;

  text-aligncenter;

  line-height80px;

}

header .head2 nav ul li a:hover {

  background-colorrgba(2552552550.5);

  colorwhite;

}


html页面

<!DOCTYPE html>

<html lang="en">


<head>

  <meta charset="UTF-8" />

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />

  <title>Carrer Builder-愿你就业梦</title>

  <meta name="Keywords" content="职业建构,就业,高薪,专业" />

  <meta name="Decription" content="来career builder,获取你的心仪offer" />

  <link rel="stylesheet" href="./CSS/css1.css">

</head>

<body>

  <!-- 页面头部header -->

  <header>

    <div class="head2">

      <div class="logo">

        <img src="images/logo.png" alt="">

      </div>

      <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>

      </nav>

    </div>

  </header>


  <!-- 页面banner -->

  <div class="banner">

    <div class="banner-picture">

      <img src="images/banner3.jpg" alt="">

    </div>

    <div class="banner-menu">

      <form action="">

        <p>

         <input type="text" placeholder="your Name">

        </p>

        <p>

          <input type="text" placeholder="your Phone">

        </p>

        <p>

          <input type="email" placeholder="your Email">

        </p>

        <p>

          <textarea name="" id="" cols="30" rows="10" placeholder="Write Your Connect Here"></textarea>

        </p>

        <p>

          <input type="submit" value="SEND MESSAGE">

        </p>

      </form>

    </div>

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

  </div>

  <!-- 页面主要内容 -->

  <main>

    <div class="about">

      <div class="about-top">

        <h2>ABOUT</h2>

        <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>

      <div class="about-bottom">

        <div class="about-bottom-left">

          <p>A WORD ABOUT US</p>

          <p> Praesent dignissim viverra est, sed bibendum ligula congue non. Sed ac nisl et felis gravida commodo?

            Suspendisse eget ullamcorper ipsum. Suspendisse diam amet.</p>

        </div>

        <div class="about-botto-middle">

          <img src="images/bb3.jpg" alt="">

        </div>

        <div class="about-bottom-right">

        </div>

      </div>

    </div>

    <div class="pictures-and-words">

      <!-- 图文混排区域 -->

      <!-- 1 -->

      <div class="part">

        <div class="pictures">

          <img src="images/b1.jpg" alt="">

        </div>

        <div class="words">

          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

        </div>

      </div>

      <!-- 2 -->

      <div class="part">

        <div class="pictures">

          <img src="images/b2.jpg" alt="">

        </div>

        <div class="words">

          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

        </div>

      </div>

      <!-- 3 -->

      <div class="part">

        <div class="pictures">

          <img src="images/b3.jpg" alt="">

        </div>

        <div class="words">

          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

        </div>

      </div>

      <!-- 4 -->

      <div class="part">

        <div class="pictures">

          <img src="images/b4.jpg" alt="">

        </div>

        <div class="words">

          <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>

        </div>

      </div>

    </div>

    <div cl34ass="gallery">

      <h2>GALLERY</h2>

      <div class="gallery-top">

        <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>

      </div>

      <div class="gallery-bottom">

        <ul>

          <li>

            <dl>

              <dt><img src="images/03-01.jpg" alt=""></dt>

              <dd>Science</dd>

            </dl>

          </li>

          <li>

            <dl>

              <dt>

                <img src="images/03-02.jpg" alt="">

              </dt>

              <dd>Indoor Stadium</dd>

            </dl>

          </li>

          <li>

            <dl>

              <dt>

                <img src="images/03-03.jpg" alt="">

              </dt>

              <dd>Transportation</dd>

            </dl>

          </li>

          <li>

            <dl>

              <dt>

                <img src="images/03-04.jpg" alt="">

              </dt>

              <dd>Kids Room</dd>

            </dl>

          </li>

          <li>

            <dl>

              <dt>

                <img src="images/03-05.jpg" alt="">

              </dt>

              <dd>Meditation Classes</dd>

            </dl>

          </li>

          <li>

            <dl>

              <dt>

                <img src="images/03-05.jpg" alt="">

              </dt>

              <dd>Kids Play Ground</dd>

            </dl>

          </li>

        </ul>

      </div>

    </div>

  </main>

  <!-- 页面页脚 -->

  <footer>

    <p>&copy;imooc.com 京ICP备13046642号</p>

  </footer>

</body>

</html>


写回答

2回答

好帮手慕慕子

2021-08-01

同学你好,对于你的问题解答如下:

1、因为banner区域的图片没有设置宽高,默认以图片自身的宽高显示,而这个图片又比较大,导致水平方向出现滚动条。

建议:可以给banner区域的图片设置百分宽度,适应窗口的宽度,去掉水平方向的滚动条,另外,图片的高度自适应即可

http://img.mukewang.com/climg/61061c8f09999b3f03980182.jpg

2、代码书写目前是没有问题的

3、刚开学习,不知道怎么写这都是正常现象,同学也不用太担心,在练习过程中慢慢积累就可以啦。

老师这里给出的建议就是:灵活应用所学知识去实现要求的效果即可,对于不知道某处该不该写什么样式的,可以尝试不写这个样式能不能实现效果,如果不写这个样式可以实现效果,那就不用写,如果不能实现效果那就必须写这个样式了。

祝学习愉快~

1

好帮手慕慕子

2021-08-01

同学你好,左侧logo紧挨着head2盒子显示,而右侧导航内容与head2盒子之间存在间隙,导致内容整体居中存在误差,如下图所示:

http://img.mukewang.com/climg/6105fd4b09a1d13927100256.jpg

建议:去掉最后一个li的右侧间,示例:

http://img.mukewang.com/climg/6105fdc7097fad3308640158.jpg

另外,如下图所示位置,class单词拼写错误,建议调整下:

http://img.mukewang.com/climg/6105fe2b09a813e007160386.jpg

祝学习愉快~

0
hq_慕仰20210716
hp>不能发图片了,老师,好像太大了,老师您肯定能脑补到

h021-08-01
共2条回复

0 学习 · 17877 问题

查看课程