网页特效练习(1)

1.手风琴相册

elong.jpg

知识点1:a标签的伪类选择器

:link 修改从未被访问过状态下的样式
:visited 修改被访问过的状态下的样式
:hover 修改鼠标悬停在a标签上状态下的样式
:active 修改鼠标长按状态下的样式

知识点2:过渡三要素

1.1必须要有属性发生变化
1.2必须告诉系统哪个属性需要执行过渡效果
1.3必须告诉系统过渡效果持续时长

原理

利用动画效果修改鼠标悬停在a标签上状态下的样式
鼠标未悬停a标签时:单个li标签的宽度=ul总宽度/li标签个数
鼠标悬停a标签时:悬停li标签的宽度=图片的宽度
鼠标悬停a标签时:未悬停li标签的宽度=(ul总宽度-图片的宽度)/(li标签个数-1)

网页布局

特点

1.li标签包裹了一个遮罩层,增加了动画效果
2.分别给li标签增加了标题和描述,增加可访问性
3.通过背景图片定位实现图片居中


CSS样式

    /*=============================  Reset start ====================================*/

    *{
        margin: 0;
        padding: 0;
    }

    body {
        font-size: 12px;
        font-family: arial, Verdana, Geneva, Helvetica;
        color: #555;
        line-height: 20px;   
    }

    ul {
        list-style: none;
    }

    /*=============================  Reset end ====================================*/
    .mb20 {
        margin-bottom: 20px;
    }

    .mt20 {
        margin-top: 20px;
    }

    /*fold*/
    .fold_wrap {
        width: 1120px;
        overflow: hidden;
        margin: 0 auto;
    }

    .fold_wrap ul {
        width: 1120px;
        height: 260px;
        margin: 0 auto;
        overflow: hidden;
    }

    .fold_wrap ul li {
        float: left;
        width: 160px;
        height: 260px;
        position: relative;
        overflow: hidden;
        cursor: pointer;
        transition: all 0.5s;
    }

    .fold_wrap ul li .mask_b {
        position: absolute;
        overflow: hidden;
        width: 100%;
        height: 100%;
        left: 0;
        top: 0;
        background: rgba(0, 0, 0, .3);
    }
    
    .fold_wrap ul:hover li{
        width: 120px;
    }
    .fold_wrap ul li:hover{
        width: 400px;
    }
    .fold_wrap ul:hover .mask_b{
        display: block;
    }
    .fold_wrap ul li:hover .mask_b{
        display: none;
    }
 
    .fold_wrap ul li .mask_b h4 {
        color: #fff;
        width: 30px;
        margin: 0 auto;
        display: block;
        font: 30px/30px Microsoft Yahei;
        position: relative;
        padding: 30px 0 0 0;
    }

    .fold_wrap ul li .adv_intro {
        width: 92%;
        height: 40px;
        padding: 5px 4%;
        position: absolute;
        left: 0;
        bottom: -50px;
        background: #37D;
        color: #FFF;
        overflow: hidden;
    }

    .pic_auto {
        width: 100%;
        height: 100%;
    }

    .pic_auto1 {
        background: url(images/20150422_ifold1.jpg) no-repeat center 0;
    }

    .pic_auto2 {
        background: url(images/20150120_ifold2.jpg) no-repeat center 0;
    }

    .pic_auto3 {
        background: url(images/20150120_ifold3.jpg) no-repeat center 0;
    }

    .pic_auto4 {
        background: url(images/20150120_ifold4.jpg) no-repeat center 0;
    }

    .pic_auto5 {
        background: url(images/20150120_ifold5.jpg) no-repeat center 0;
    }

    .pic_auto6 {
        background: url(images/20150120_ifold6.jpg) no-repeat center 0;
    }

    .pic_auto7 {
        background: url(images/20150120_ifold7.jpg) no-repeat center 0;
    }

用JS实现

    
    
    

2.星星海




    
    
    






3.照片墙

照片墙.png



    
    
    


   

    4.天猫弹性导航

    天猫弹性导航.png
    
    
    
        
        
        
    
    
    
    
    
    
    

    5.放大镜效果

    
    
    
        
        
        
    
    
       

    6.进度条

    
    
    
        
        Title
        
    
    
        
    0%

    7.商品展示

    商品展示.png
    
    
    
        
        
        
    
    
        

    你可能感兴趣的:(网页特效练习(1))