Animate an element's width from 0 to 100%, with it and it's wrapper being only as wide as they need to be, without a pre-set width, in CSS3 or jQuery

前端 未结 6 1179
误落风尘
误落风尘 2020-12-01 03:22

http://jsfiddle.net/nicktheandroid/tVHYg/

When hovering .wrapper, it\'s child element .contents should animate from 0px to it\

6条回答
  •  孤街浪徒
    2020-12-01 04:07

    Please check following snippet

     /* DEBUG */
    .lwb-col {
        transition: box-shadow 0.5s ease;
    }
    .lwb-col:hover{
        box-shadow: 0 15px 30px -4px rgba(136, 155, 166, 0.4);
     
    }
    
    
    .lwb-col--link {
        font-weight: 500;
      position: relative;
      display: inline-block;
    }
    .lwb-col--link::after{
        border-bottom: 2px solid;
        bottom: -3px;
        content: "";
        display: block;
        left: 0;
        position: absolute;
        width: 100%;
        color: #E5E9EC;
    
    }
    .lwb-col--link::before{
        border-bottom: 2px solid;
        bottom: -3px;
        content: "";
        display: block;
        left: 0;
        position: absolute;
        width: 100%;
        color: #57B0FB;
        transform: scaleX(0);
        
    
    }
    .lwb-col:hover .lwb-col--link::before {
        border-color: #57B0FB;
        display: block;
        z-index: 2;
        transition: transform 0.3s;
        transform: scaleX(1);
        transform-origin: left center;
    }

    Webdesign

    Steigern Sie Ihre Bekanntheit im Web mit individuellem & professionellem Webdesign. Organisierte Codestruktur, sowie perfekte SEO Optimierung und jahrelange Erfahrung sprechen für uns.

    Mehr erfahren

提交回复
热议问题