第 20 章 项目实战—资讯内容[5,6]

学习要点:

1.资讯内容

主讲教师:李炎恢

本节课我们制作一下子栏目资讯内容。

一.资讯内容

//谷歌浏览器解析的顺序调整,需要全部加载后执行

  1. $(window).load(function() {
  2. $('.text').eq(0).css('margin-top', ($('.auto').eq(0).height() - $('.text').eq(0).height()) / 2 + 'px');
  3. });

注:对于 Firefox 浏览器,可以按 Ctrl+Shift+M,调整移动端尺寸。

//子栏目标题

  1. <div class="jumbotron">
  2. <div class="container">
  3. <hgroup>
  4. <h1>资讯</h1>
  5. <h4>企业内训的最新动态、资源等...</h4>
  6. </hgroup>
  7. </div>
  8. </div>

//栏目 CSS

  1. .jumbotron { margin: 50px 0 0 0; padding: 60px 0; background: #ccc url(../img/bg.jpg); color: #ccc;
  2. } .jumbotron h1 { font-size: 26px;//768,30; 992,33; 1200,36;
  3. padding: 0 0 0 20px;
  4. } .jumbotron h4 { font-size: 16px;//768,16; 992,17; 1200,18
  5. padding: 0 0 0 20px;
  6. }

//资讯内容

  1. <div id="information">
  2. <div class="container">
  3. <div class="row">
  4. <div class="col-md-8 info-left">
  5. <div class="container-fluid" style="padding:0;">
  6. <div class="row info-content">
  7. <div class="col-md-5 col-sm-5 col-xs-5">
  8. <img src="img/info1.jpg" class="img-responsive" alt="">
  9. </div>
  10. <div class="col-md-7 col-sm-7 col-xs-7">
  11. <h4>广电总局发布 TVOS2.0 华为阿里参与研发</h4>
  12. <p class="hidden-xs"> TVOS2.0 是在 TVOS1.0 与华为 MediaOS 及阿里巴巴 YunOS 融合的基础上,打造的新一代智能电视操作系统。华为主要承担开发工作,内置的电视购物商城由阿里方面负责。 </p>
  13. <p> admin 15 / 10 / 11 </p>
  14. </div>
  15. </div>
  16. </div>
  17. </div>
  18. <div class="col-md-4 info-right hidden-xs hidden-sm">
  19. <blockquote>
  20. <h2>热门资讯</h2>
  21. </blockquote>
  22. <div class="container-fluid">
  23. <div class="row">
  24. <div class="col-md-5 col-sm-5 col-xs-5" style="margin:12px 0;padding:0;">
  25. <img src="img/info3.jpg" class="img-responsive" alt="">
  26. </div>
  27. <div class="col-md-7 col-sm-7 col-xs-7" style="padding-right:0">
  28. <h4>标题</h4>
  29. <p> admin 15 / 10 / 11 </p>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>

//资讯内容 CSS

  1. #information { padding: 40px 0; background: #eee;
  2. } .info-right { background-color: #fff; box-shadow: 2px 2px 3px #ccc;
  3. } .info-right blockquote { padding: 0; margin: 0;
  4. } .info-right h2 { font-size: 20px; padding: 5px;
  5. } .info-right h4 { line-height: 1.6;
  6. } .info-content { background-color: #fff; box-shadow: 2px 2px 3px #ccc; margin: 0 0 20px 0;
  7. } .info-content img { margin: 12px 0;
  8. } .info-content h4 { font-size: 14px;//768,16; 992,18; 1200,20;
  9. padding: 2px 0 0 0;
  10. } .info-content p { line-height: 1.6; color: #666;
  11. }

//对于.info-content h4,在中屏和大屏需要保持一行。

  1. .info-content h4 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  2. }