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>MIS测试平台</title>
        <link rel="stylesheet" type="text/css" href="../static/CSS/10.20.css">
    </head>
    <body>
    <div>
        <div class="img">
            <a href="http://www.gzcc.cn"><img src="http://old.bz55.com/uploads/allimg/150316/140-150316134616.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="http://www.pp3.cn/uploads/201701/2017011709.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="http://old.bz55.com/uploads/allimg/150316/140-150316134610.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="http://old.bz55.com/uploads/allimg/150316/140-150316134613.jpg"></a>
            <div class="desc"><a href="http://www.gzcc.cn">第四张图片</a></div>
        </div>
    
    </div>
    
    <div class="clearfloat">
        <img src="http://old.bz55.com/uploads/allimg/150316/140-150316134616.jpg">
        <img src="http://www.pp3.cn/uploads/201701/2017011709.jpg">
        <img src="http://old.bz55.com/uploads/allimg/150316/140-150316134610.jpg">
        <img src="http://old.bz55.com/uploads/allimg/150316/140-150316134613.jpg">
    </div>
    
    </body>
    </html>
    div.img{
        width: 180px;
        border:1px solid #eeeeee;
        float: left;
        margin:5px;
    }
    img{
        width:300px;
    }
    
    div.img img{
    width: 100%;
        height: auto;
    
    }
    div.desc{
        text-align: center;
        padding: 5px;
    }
    
    div.clearfloat{
        clear: both;
    }
    
    div.img:hover{
        border: 1px solid blue;
    }

  • 相关阅读:
    Ansi,UTF8,Unicode,ASCII编码的区别
    Delphi 快捷键
    Sql Server2008恢复备份数据库问题
    js图片无缝滚动代码
    SQL Server 2008 清空删除日志文件 130G日志 10秒内变10M .
    JavaScript_循环26个英文字母的方法 .
    iframe跨子域
    sql数据库该名字
    大型网站架构的优化与架构演变(整理) .转自网络
    删除SQL日志语句,经测试8G日志文件都可以删除
  • 原文地址:https://www.cnblogs.com/Naiky/p/7699546.html
Copyright © 2011-2022 走看看