zoukankan      html  css  js  c++  java
  • CSS实例:图片导航块


    1. 认识CSS的 盒子模型。
    2. CSS选择器的灵活使用。
    3. 实例:
      1. 图片文字用div等元素布局形成HTML文件。
      2. 新建相应CSS文件,并link到html文件中。
      3. CSS文件中定义样式
        1. div.img:border,margin,width,float
        2. div.img img:width,height
        3. div.desc:text-align,padding
        4. div.img:hover:border
        5. div.clearfloat:clear
          <!DOCTYPE html>
          <html lang="en">
          <head>
              <meta charset="UTF-8">
              <title>img</title>
              <link rel="stylesheet" type="text/css" href="static/css/20.css">
          </head>
          <body>
          <div class="recommend">
              <div class="img">
                  <a  href="http://www.gzcc.cn"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501835&di=ee39b28ecbf99c25f74d58d9ffe82324&imgtype=0&src=http%3A%2F%2Fimg15.3lian.com%2F2015%2Fa1%2F17%2Fd%2F103.jpg"></a>
                  <div class="desc"><a href="http://www.gzcc.cn">校园风光</a></div>
          </div>
              <div class="img">
                  <a href="http://www.gzcc.cn"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501837&di=b38f6bdf60876058de40ffeccf9594a2&imgtype=0&src=http%3A%2F%2Fimage82.360doc.com%2FDownloadImg%2F2015%2F02%2F1702%2F50258430_3.jpg" ></a>
                  <div class="desc"><a href="http://www.gzcc.cn">校友风采</a></div>
              </div>
              <div class="img">
                  <a href="http://www.gzcc.cn"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501834&di=08e20a1a9a471027dd2aebfaa10e174a&imgtype=0&src=http%3A%2F%2Fimg0.ph.126.net%2Fq56WqeGz-DIkd2j_KfgERA%3D%3D%2F6599319367447546437.jpg" ></a>
                  <div class="desc"><a href="http://www.gzcc.cn">学校文化</a></div>
              </div>
          </div>
          <div class="clearfloat">
              <a href="http://www.gzcc.cn"><img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501837&di=b38f6bdf60876058de40ffeccf9594a2&imgtype=0&src=http%3A%2F%2Fimage82.360doc.com%2FDownloadImg%2F2015%2F02%2F1702%2F50258430_3.jpg" alt="4"></a><br>
              <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501837&di=cbcfba0d0f86734c5f58d3a308652e41&imgtype=0&src=http%3A%2F%2Fimage13-c.poco.cn%2Fmypoco%2Fmyphoto%2F20120603%2F10%2F44921306201206031053543978391258438_003.jpg" ><br>
              <img src="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1508470501836&di=a88a803aa561194b736956cd90a58b87&imgtype=0&src=http%3A%2F%2Fimg17.3lian.com%2Fd%2Ffile%2F201701%2F05%2F053489996fcb1584914fff107651c81f.jpg" ><br>
          </div>
          </body>
          </html>>
          img{
                       300px;
                  }
          div.img{
               border: 1px solid #ccc;
                180px;
              height: 180px;
               float: left;
               margin: 5px;
           }
          div.img img{
               100%;
              height: auto;
          }
          div.desc{
              text-align: center;
              padding: 5px;
          }
          div.img:hover{
              border: 1px solid red;
          }
          div.clearfloat{
              clear: both;
          }

          clearfloat:clear
  • 相关阅读:
    Windows系统安装Anaconda
    python的下载及安装
    VMware的虚拟网络编辑器,在配置的过程中没有桥接模式!(虚拟机卸载)
    常见端口查询
    《网络攻防实践》第三次作业实践二
    用ssh方式在kali与Windows之间传输文件
    oracle常用函数汇总
    JSON 日期格式带 T 问题
    sql远程连接卡死解决方法
    DropdownList的处理总结
  • 原文地址:https://www.cnblogs.com/chenhuafei/p/7698310.html
Copyright © 2011-2022 走看看