代码已放到百度云https://pan.baidu.com/s/1o259FGzlT16Fy50YqP9tlw?pwd=1101

提取码:1101

需要用到bootstrap  jQuery 注意使用的版本 

<link rel="stylesheet" href="../bootstrap-4.6.1-dist/css/bootstrap.css">
    <script type="text/javascript"src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="../bootstrap-4.6.1-dist/js/bootstrap.js"></script>

HTML部分代码

<body>
    <div class="maxbox">
        <div class="top">
          <!-- 包裹起来使用flex布局固定在中间 -->
          <div class="topin">
            <img src="./images/logo.jpg" alt="" srcset="">
            <div class="links">
                  <div>
                    <ul class="liks">
                      <li><img src="./images/xb.jpg" alt="" srcset=""><a href="">设为首页</a> </li>
                      <li><img src="./images/xb.jpg" alt="" srcset=""><a href="">加入收藏</a></li>
                    </ul>
                    <ul class="links2">
                        <li><a href="">益智教育</a></li>
                        <li><a href="">课程介绍</a></li>
                        <li><a href="">创意展示</a></li>
                        <li><a href="">学员中心</a></li>
                        <li><a href="">新闻动态</a></li>
                        <li><a href="">关于我们</a></li>
                        <li><a href="">联系我们</a></li>
                    </ul>
                  </div>
            </div>
          </div>
        </div>
        <!-- bootstrap 轮播图 -->
        <div class="content">
          <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" style="width: 1010px;">
            <ol class="carousel-indicators">
              <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
              <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
              <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
              <div class="carousel-item active">
                <img src="./images/banner01.jpg" class="d-block w-100" alt="..." style="width: 380px;">
              </div>
              <div class="carousel-item">
                <img src="./images/banner02.jpg" class="d-block w-100" alt="..." style="width: 380px;">
              </div>
              <div class="carousel-item">
                <img src="./images/banner03.jpg" class="d-block w-100" alt="..." style="width: 380px;">
              </div>
            </div>
            <button class="carousel-control-prev" type="button" data-target="#carouselExampleIndicators" data-slide="prev">
              <span class="carousel-control-prev-icon" aria-hidden="true"></span>
              <span class="sr-only">Previous</span>
            </button>
            <button class="carousel-control-next" type="button" data-target="#carouselExampleIndicators" data-slide="next">
              <span class="carousel-control-next-icon" aria-hidden="true"></span>
              <span class="sr-only">Next</span>
            </button>
          </div>
        </div>
        <div class="content2">
          <div class="boxleft">
              <div class="cltop">
                  <div class="imga1">
                    <div style="float: right; margin-top: 5px; margin-right: 15px;"><a href="" style="color: white;">更多>></a></div>
                    <div class="boxsml">
                          <img src="./images/pic1.jpg" alt="" srcset="">
                          <span style="width: 200px; height: 120px; margin-top: 10px;">中心介绍: 快乐中学习,创造中成长 北京乐益达教育科技有限公司,以著名儿童心理学家皮亚杰的“做中学”(learning by making)理论及著名发展心理…</span>
                    </div>
                  </div>
                  <div class="imga2">
                    <div style="float: right; margin-top: 5px; margin-right: 15px;"><a href="" style="color: white;">更多>></a></div>
                    <div class="boxsml">
                          <img src="./images/pic2.jpg" alt="" srcset="">
                          <span style="width: 200px; height: 120px; margin-top: 10px;">
                                <ul>
                                  <li><a href="">【企业新闻】机器人课程开始了</a></li>
                                  <li><a href="">【企业新闻】机器人课程开始了</a></li>
                                  <li><a href="">【企业新闻】机器人课程开始了</a></li>
                                  <li><a href="">【企业新闻】机器人课程开始了</a></li>
                                </ul>
                          </span>
                    </div>
                  </div>
              </div>
              <div class="clbotm">
                  <div class="cbtop"></div>
                  <div class="cbtom">
                    <div class="ExpertList">
                      <ul>
                        <li>
                          <img src="./images/pic_1.jpg" alt="Michael Littlewood" title="Michael Littlewood" />
                        </li>
                        <li>
                          <img src="./images/pic_2.jpg" alt="Michael Littlewood" title="Michael Littlewood" />
                        </li>
                        <li>
                          <img src="./images/pic_3.jpg" alt="Michael Littlewood" title="Michael Littlewood" />
                        </li>
                        <li>
                          <img src="./images/pic_4.jpg" alt="Michael Littlewood" title="Michael Littlewood" />
                        </li>
                        <li>
                          <img src="./images/pic_5.jpg" alt="Michael Littlewood" title="Michael Littlewood" />
                        </li>
                      </ul>
                      <!--左右白色渐变蒙版-->
                      <div class="ExpertLeft"></div>
                      <div class="Expertright"></div>
                    </div>
                  </div>
              </div>
          </div>
          <div class="boxright">
            <div class="topimg">
                <ul>
                  <li>
                    <div class="pai">
                      <img src="./images/intro01.jpg" alt="" srcset="">
                      <div>
                        <span style="width: 200px; height: 120px; margin-top: 10px;">
                          <ul>
                            <li><b>3+ 意识世界</b></li>
                            <li>3+ 意识世界 自我意<br>识的发展是在孩子成<br>长中极…</li>
                          </ul>
                        </span>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="pai">
                      <img src="./images/intro02.jpg" alt="" srcset="">
                      <div>
                        <span style="width: 200px; height: 120px; margin-top: 10px;">
                          <ul>
                            <li><b>4+ 发现世界</b></li>
                            <li>4+ 发现世界 在玩乐<br>的过程中,发现身边<br>的世界,培…        
                             </li>
                          </ul>
                        </span>
                      </div>
                    </div>
                  </li>
                </ul>
            </div>
            <div class="botmimg">
                <a href=""><img src="./images/zxyy.jpg" alt="" srcset=""></a>
                <a href=""><img src="./images/gfwb.jpg" alt="" srcset=""></a>
            </div>
          </div>
        </div>
        <div class="bottom">
          <div class="bopin">
            <img src="./images/bottom_logo.jpg" alt="" srcset="">
              <div class="texts">
                <p>乐益达教育 版权所有 京ICP备09021854号</p>
                <p>copyright @2010-2011 gdyapei.com all rights reserved 站长统计</p>
              </div>
            </div>
          </div>
        </div>
    </div>
</body>

jquey代码

<script>
  //获取窗口的宽度
  var width_window = $(window).width();
  var liLengthu, BoxWidth, ExpertHtml, ExpertList;
  var a = 1,
    b = 1;
  $(function() {

    //轮播
    Expert();

  });

  function Expert() {
    //获取li的个数
    liLengthu = $(".ExpertList ul li").length;
    //获取轮播盒子的宽度
    BoxWidth = $(".ExpertList").outerWidth();
    //轮播的内容
    ExpertHtml = $(".ExpertList ul").html();

    //如果li的个数不够6个 就循环添加
    if (liLengthu < 6) {
      for (var i = liLengthu; i < 6; i++) {
        $(".ExpertList ul").append(ExpertHtml);
      }
    } else {

    }
    ExpertHtml = $(".ExpertList ul").html();
    $(".ExpertList ul").append(ExpertHtml);
    liLengthu = $(".ExpertList ul li").length;
    $(".ExpertList ul").css({
      "width": liLengthu * 200 + "px"
    });
    ExpertList = setInterval(ExpertBanner, 20);
  }

  //轮播
  function ExpertBanner() {
    a++;
    b++;
    if (b >= BoxWidth - 200) {
      b = 1;
      $(".ExpertList ul").append(ExpertHtml);
      liLengthu = $(".ExpertList ul li").length;
      $(".ExpertList ul").css({
        "width": liLengthu * 200 + "px"
      });
    } else {

    }
    $(".ExpertList ul").css({
      "margin-left": "-" + a + "px"
    });
  }
  //鼠标hover时 暂停轮播
  $(document).on("mouseover", ".ExpertList", function() {
    clearInterval(ExpertList);
  });
  //鼠标离开时 继续轮播
  $(document).on("mouseout", ".ExpertList", function() {
    ExpertList = setInterval(ExpertBanner, 20);
  });
</script>

css样式

*{
    margin: 0;
    padding: 0;
    list-style: none;
}
.maxbox{
    height: 1000px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* 导航栏样式 */
.top{
    background-color: #f0f9fe;
    width: 100%;
    border-bottom: 4px solid #3fb0dc;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}
.topin{
  width: 1010px;
  height: 105px;
  display: flex;
  justify-content: space-between;
}
.links{
  width: 735px;
  height: 110px;
}
.liks{
  margin-top: 25px;
  display: flex;
  justify-content: flex-end;
}
.liks li{
    float: left;
    width: 100px;  
}
.liks li a{
    color: black; 
}
.links2{
  margin-top: 20px;
  display: flex;
  justify-content: space-around;
}
.links2 li{
  float: left;
}
.links2 a{
  color: black;
  font-weight: 800;
}

/* 轮播图部分大小样式 */
.content{
    width: 100%;
    height: 380px;
    display: flex;
    align-items: center;
    flex-direction: column;
    background-color: #ebeae6;
}


/* 展示栏样式 */
.content2{
    height: 440px;
    display: flex;
    /* 固定好div位置 防止后面被挤走 */
    flex-direction: row;
    justify-content: space-between;
}
.boxleft{
  width: 720px;
  height: 435px;
  /* background-color: blanchedalmond; */
}
.boxright{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  width: 285px;
  height: 435px;
  /* background-color: rgb(148, 95, 15); */
}
.cltop{
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.clbotm{
  margin-left: 10px;
  height: 180px;
  width: 700px;
  /* background-color: cyan; */
  border: 1px solid rgb(161, 163, 163);
}
.imga1,.imga2{
  height: 165px;
  width: 340px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border: 1px solid rgb(161, 163, 163);
  /* 查看排版是否正确 */
  /* background-color: blue; */
}
.imga1{
  background: url(../images/lydjy.jpg) no-repeat;
}
.imga2{
  background: url(../images/xwdt.jpg) no-repeat;
}
.imga2 li{
  margin: 5px;
}
.boxsml{
  width: 350px;
  height: 120px;
  margin-top: 40px;
  display: flex;
  font-size: 13px;
  align-items: center;
  justify-content: space-evenly;
}
.cbtop{
  height: 45px;
  width: 700px;
  background: url(../images/cyzs.jpg) no-repeat;
  background-position: 13px 13px;
  border-bottom: 2px dashed rgb(6, 119, 212);
}
.ExpertList {
        margin: 0 auto;
        margin-top: 22px;
        overflow: hidden;
        position: relative;
        text-align: center;
        width: 695px;
    }
/* 跑马灯样式 */
    .ExpertList ul {
        overflow: auto;
    }

    .ExpertList ul li {
        float: left;
        box-sizing: border-box;
        text-align: center;
        display: inline-block;
        width: 120px;
        height: 100px;
        list-style: none;
        margin-left: 30px;
    }

.topimg{
  margin-top: -20px;
width: 265px;
height: 280px;
display: flex;
align-items: center;
justify-content: flex-end;
background: url(../images/bg_intro.png);
}
.botmimg{
  margin-top: -50px;
display: flex;
justify-content: space-between;
height: 80px;
width: 265px;
}
.pai{
margin-top: 15px;
width: 250px;
height: 80px;
display: flex;
align-items: center;
font-size: 14px;
}
.pai img{
margin-left: 20px;
}
.pai div{
margin-top: 3px;
margin-left: 2px;
}

.bottom{
    background-color: #c8e5e9;
    width: 100%;
    height: 75px;
    display: flex;
    justify-content: center;
}
.bopin{
  width: 1010px;
  height: 75px;
  display: flex;
  justify-content: space-between;
}
.texts{
  width: 833px;
  margin-top: 15px;
  text-align: center;
}
.texts p{
  margin: 0;
}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐