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>cat</title>
              <link rel="stylesheet" type="text/css" href="../static/css/999.css">
          </head>
          <body>
          <div class="recommend">
               <div class="img">
                   <a href="http://www.gzcc.cn"><img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1664236656,63286980&fm=27&gp=0.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://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1938658724,934922317&fm=27&gp=0.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://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3954444860,4265276854&fm=27&gp=0.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://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3796435997,1132599894&fm=27&gp=0.jpg"></a>
                   <div class="desc"><a href="http://www.gzcc.cn">学生风采</a></div>
               </div>
           </div>
           <br>
          <div class="clearfolat">
               <img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2784767349,280601387&fm=27&gp=0.jpg" >
               <img src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3850212695,1583302983&fm=27&gp=0.jpg" >
               <img src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1771144366,2639418356&fm=27&gp=0.jpg" >
               <img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=4202714413,2405027103&fm=27&gp=0.jpg" >
          </div>
          </div>
          </body>
          </html>
           img {
                 300px;
            }
            div.img{
                border:1px solid #cccccc;
                float: left;
                margin: 5px;
                180px;
            }
           div.img img{
               100%;
               height:auto;
           }
           div.desc{
               text-align: center;
               padding: 5px;
           }
           div.img:hover{
                border:1px solid #000000;
           }
           div.clearfolat{
               clear: both;
           }
          复制代码

  • 相关阅读:
    团队第二次冲刺10(6.03)
    购买图书问题
    找水王02
    学习进度13
    团队第二次冲刺09(6.02)
    团队第二次冲刺08(6.01)
    C++通过Swig跨线程回调Python代码
    Windows 10系统永久关闭Windows Defender Antivirus防病毒程序方法
    Windows系统Python直接调用C++ DLL
    Windows10系统Python2.7通过Swig调用C++过程
  • 原文地址:https://www.cnblogs.com/cch-1007/p/7701445.html
Copyright © 2011-2022 走看看