css实现10种鼠标悬浮图片卡片文字显示动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现10种鼠标悬浮图片卡片文字显示动画效果代码

代码标签: css 卡片 图片 悬浮 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/font-awesome-4.7.0/css/font-awesome.min.css">
    <style>
        *,
        *::before,
        *::after {
            box-sizing: border-box;
        }
        
        html {
            font-family: sans-serif;
            line-height: 1.15;
            -webkit-text-size-adjust: 100%;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }
        
        body {
            font-family: 'Lato', sans-serif;
            color: #454545;
            font-weight: 400;
            background: #ffffff;
        }
        
        a {
            color: #333333;
            font-weight: 400;
            outline: none;
            text-decoration: none;
            transition: 0.5s;
        }
        
        a:hover,
        a:active,
        a:focus {
            outline: none;
            text-decoration: none;
        }
        
        p {
            padding: 0;
            margin: 0 0 15px 0;
            color: #454545;
            font-weight: 400;
        }
        
        h1,
        h2,
        h3,
        h4,
        h5,
        h6 {
            padding: 0;
            margin: 0 0 15px 0;
            color: #333333;
            font-weight: 700;
            
        }
        
        h1 {
            font-weight: 900;
        }
        
        img {
            width: 100%;
            height: auto;
        }
        
        .credit {
        	padding: 30px 15px 0 15px;
        	text-align: center;
        	font-size: 30px;
        	font-weight: 400;
        }
        
        .credit a {
        	font-weight: 900;
        	color: #000000;
        	text-decoration: underline;
        }
        
        
        
        /**********************************/
        /***** Layout & Section Title *****/
        /**********************************/
        .container {
            width: 100%;
            padding-right: 15px;
            padding-left: 15px;
            margin-right: auto;
            margin-left: auto;
        }
        
        @media (min-width: 576px) {
            .container {
                max-width: 540px;
            }
        }
        
        @media (min-width: 768px) {
            .container {
                max-width: 720px;
            }
        }
        
        @media (min-width: 992px) {
            .container {
                max-width: 960px;
            }
        }
        
        @media (min-width: 1200px) {
            .container {
                max-width: 1140px;
            }
        }
        
        .row {
            display: -ms-flexbox;
            display: flex;
            -ms-flex-wrap: wrap;
            flex-wrap: wrap;
            margin-right: -15px;
            margin-left: -15px;
        }
        
        .column {
            position: relative;
            width: 100%;
            padding-right: 15px;
            padding-left: 15px;
            -ms-flex: 0 0 100%;
            flex: 0 0 100%;
            max-width: 100%;
        }
        
        @media (min-width: 576px) {
            .column {
                -ms-flex: 0 0 100%;
                flex: 0 0 100%;
                max-width: 100%;
            }
        }
        
        @media (min-width: 768px) {
            .column {
                -ms-flex: 0 0 50%;
                flex: 0 0 50%;
                max-width: 50%;
            }
        }
        
        @media (min-width: 992px) {
            .column {
                -ms-flex: 0 0 33.333333%;
                flex: 0 0 33.333333%;
                max-width: 33.333333%;
            }
        }
        
        .section-title {
            position: relative;
            width: 100%;
            text-align: center;
            padding: 45px 0 30px 0;
        }
        
        .section-title::after {
            position: absolute;
            content: "";
            width: 100%;
            height: 1px;
            left: 0;
            background: #eeeeee;
        }
        
        .section-title h1 {
            color: #353535;
            font-size: 50px;
            letter-spacing: 5px;
            margin-bottom: 5px;
        }
        
        @media(max-width: 767.98px) {
            .section-title h1 {
                font-size: 40px;
                letter-spacing: 3px;
            }
        }
        
        @media(max-width: 567.98px) {
            .section-title h1 {
                font-size: 30px;
                letter-spacing: 2px;
            }
        }
        
        
        
        /**********************************/
        /********** Effect #1 CSS *********/
        /**********************************/
        .effect-1 {
            position: relative;
            margin-bottom: 30px;
            overflow: hidden;
        }
        
        .effect-1 .effect-img {
            font-size: 0;
        }
        
        .effect-1 .effect-img img {
            width: 100%;
            height: auto;
        }
        
        .effect-1 .effect-text {
            position: absolute;
            width: 100%;
            height: 100%;
            padding: 30px;
            top: calc(100% - 60px);
            left: 0;
            text-align: center;
            background: rgba(0, 0, 0, .5);
            transition: .5s;
        }
        
        .effect-1:hover .effect-text {
            top: 0;
        }
        
        .effect-1 .effect-text h2 {
            height: 45px;
            color: #ffffff;
            font-size: 25px;
            margin: -15px 0 0 0;
            transition: .5s;
        }
        
        .effect-1:hover .effect-text h2 {
            margin: 0;
        }
        
        .effect-1 .effect-text p {
            color: #ffffff;
            font-size: 16px;
            margin-bottom: 20px;
        }
        
        
        .effect-1 .effect-btn .btn {
            display: inline-block;
            height: 35px;
            padding: 7px 15px;
            color: #333333;
            background: #ffffff;
        }
        
        
        
        /**********************************/
        /********** Effect #2 CSS *********/
        /**********************************/
        .effect-2 {
            position: relative;
            margin-bottom: 30px;
            overflow: hidden;
        }
        
        .effect-2 .effect-img {
            position: relative;
            font-size: 0;
            overflow: hidden;
        }
        
        .effect-2 .effect-img img {
            position: relative;
            width: 100%;
            height: auto;
            transform: scale(1.2);
            bottom: -25px;
            transition: .5s;
        }
        
        .effect-2:hover .effect-img img {
            bottom: 0;
        }
        
        .effect-2 .effect-text {
            position: absolute;
            width: 100%;
            height: 100%;
            padding: 30px;
            top: 50%;
            left: 0;
            text-align: center;
            background: rgba(0, 0, 0, .2);
            opacity: 0;
            transition: .5s;
        }
        
        .effect-2:hover .effect-text {
            top: 0;
            opacity: 1;
        }
        
        .effect-2 .effect-text p {
            color: #ffffff;
            font-size: 18px;
            margin-bottom: 20px;
        }
        
        .effect-2 .effect-btn {
            position: absolute;
            width: 100%;
            padding: 15px 7.5px;
            left: 0;
            bottom: 0;
            background: rgba(0, 0, 0, .5);
        }
        
        .effect-2 .effect-text h2 {
            display: inline-block;
            color: #ffffff;
            font-size: 22px;
            font-weight: 400;
            float: left;
            margin: 5px 7.5px 0 7.5px;
        }
        
        
        .effect-2 .effect-btn .btn {
            position: relative;
            display: inline-block;
            float: right;
            height: 35px;
            padding: 7px 15px;
            margin: 0 7.5px;
            color: #333333;
            background: #ffffff;
        }
        
        
        
        /**********************************/
        /********** Effect #3 CSS *********/
        /**********************************/
        .effect-3 {
            position: relative;
            margin-bottom: 30px;
            overflow: hidden;
        }
        
        .effect-3 .effect-img {
            font-size: 0;
            overflow: hidden;
        }
        
        .effect-3 .effect-img img {
            width: 100%;
            height: auto;
            transition: .3s;
        }
        
        .effect-3:hover .effect-img img {
            transform: scale(1.2);
        }
        
        .effect-3 .effect-text {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            padding: 30px;
            text-align: center;
            background: rgba(0, 0, 0, .5);
            transition: .5s;
            transform: scale(0);
            opacity: 0;
        }
        
        .effect-3:hover .effect-text {
            transform: scale(1);
            opacity: 1;
        }
        
        .effect-3 .effect-text h2 {
            height: 45px;
            color: #ffffff;
            font-size: 25px;
            margin: 0;
        }
        
        .effect-3 .effect-text p {
            color: #ffffff;
            font-size: 16px;
            margin-bottom: 20px;
        }
        
        
        .effect-3 .effect-btn .btn {
            display: inline-block;
            height: 35px;
            padding: 7px 15px;
            color: #333333;
            background: #.........完整代码请登录后点击上方下载按钮下载查看

网友评论0