CSS实例:图片导航块

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>img</title>
    <link rel="stylesheet" type="text/css"href="jjj.css">
</head>
<body>

    <div>
        <div class="img">
            <a href="http://pal4.roogames.com/">
                <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_d_22.jpg"></a>
            <div class="desc"><a href="http://pal4.roogames.com/">慕容紫英</a></div>
       </div>
        <div class="img">
        <a href="http://pal4.roogames.com/">
            <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_d_23.jpg">
        </a>
        <div class="desc"><a href="https://baike.baidu.com/item/%E4%BA%91%E5%A4%A9%E6%B2%B3/11894?fr=aladdin">云天河</a> </div>
    </div>
        <div class="img">
        <a href="http://pal4.roogames.com/">
            <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_24.jpg">
        </a>
        <div class="desc"><a href="http://pal4.roogames.com/">柳梦璃</a> </div>
    </div>
        <div class="img">
        <a href="http://pal4.roogames.com/">
            <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_03.jpg">
        </a>
        <div class="desc"><a href="http://pal4.roogames.com/">韩菱纱</a> </div>
    </div>


</div>





<div class="clearfloat">
      <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_d_22.jpg">
      <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_d_23.jpg">
      <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_24.jpg">
      <img src="http://pal4.roogames.com/pal4/pal4index_files/pic/pic_03.jpg">

</div>
</body>>
</html>
 img{
    width: 300px;
}
div.img{
    border: 1px solid seagreen;
    width: 180px;
    float: left;
    margin: 5px;
}
div.img img{
    width: 100%;
    height: auto;
}
div.desc{
    text-align: center;
    padding: 5px;
}
div.img:hover{
    border:1px solid blue;
}
.clearfloat{
    clear: both;

}

posted @ 2017-10-20 14:36  055刘柏坚  阅读(181)  评论(0编辑  收藏  举报