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

    1. 认识CSS的 盒子模型。
    2. CSS选择器的灵活使用。
    3. 实例:
      1. 图片文字用div等元素布局形成HTML文件。
      2. 新建相应CSS文件,并link到html文件中。
      3. CSS文件中定义样式
      4. div.img:border,margin,width,float;    div.img img:width,height;     div.desc:text-align,padding;        div.img:hover:border;     div.clearfloat:clear;
    4. <!DOCTYPE html>
      <html lang="en">
      <head>
          <meta charset="UTF-8">
          <title>img</title>
           <link rel="stylesheet" type="text/css" href="../static/202.css">
      </head>
      <body>
      <div>
        <div class="img">
             <a href="http://www.gzcc.cn/">
                 <img src="http://static.runoob.com/images/demo/demo4.jpg">
             </a>
            <div class="d"><a href="http://www.gzcc.cn/">校园风光</a></div>
        </div>
          <div class="img">
             <a href="http://www.gzcc.cn/">
                 <img src="http://static.runoob.com/images/demo/demo3.jpg">
             </a>
            <div class="d"><a href="http://www.gzcc.cn/">长河落日圆</a></div>
        </div>
          <div class="img">
             <a href="http://www.gzcc.cn/">
                 <img src="http://static.runoob.com/images/demo/demo2.jpg">
             </a>
            <div class="d"><a href="http://www.gzcc.cn/">速度七十二迈</a></div>
        </div>
          <div class="img">
             <a href="http://www.gzcc.cn/">
                 <img src="http://static.runoob.com/images/demo/demo1.jpg">
             </a>
            <div class="d"><a href="http://www.gzcc.cn/">花前月下</a></div>
        </div>
           </div>
          <div class="clearfolat">
           <img src="http://static.runoob.com/images/demo/demo4.jpg"><br>
           <img src="http://static.runoob.com/images/demo/demo3.jpg"><br>
           <img src="http://static.runoob.com/images/demo/demo2.jpg"><br>
           <img src="http://static.runoob.com/images/demo/demo1.jpg"><br>
       </div>
      
      </body>
      </html>

      css

    5. 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;
          }
          .clearfolat{
              clear: both;
          }

       

  • 相关阅读:
    [Erlang05]gen_server怎么去写eunit?
    [Erlang04]为什么有了rpc还有net_kernel:connect/1?
    [Erlang03]Erlang有哪些好用的静态分析工具?
    [SIP01]SIP Header Fields里面各字段用途
    [SIP00]SIP 概念总结
    [Erlang00]:gen_server:reply/2
    Makefile教程
    Linux 环境下开发 STM32
    Ubuntu 18.04 + ROS Melodic + TurtleBot3仿真
    Ubuntu系统鼠标不能点击
  • 原文地址:https://www.cnblogs.com/00js/p/7698774.html
Copyright © 2011-2022 走看看