Css 带有两个说明文字的图片悬停

Css image hover with two captions

我一直在尝试创建一个图像,悬停时标题会在顶部从左向右滑出,在底部从左向右滑出。我已经让它在两个单独的图像上工作,即:一个图像有顶部标题,一个图像有底部标题;但是我似乎无法同时处理一张图片。此外,我正在尝试让标题和图像缩放到令我感到困惑的容器。我尝试的另一件事是将两个 div 插入顶部幻灯片标题并让它们缩放到大小但我无法让它继续。 这是我目前的代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>slide caption thingy</title>
    <link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
<body>
    <div class="wrapper">

        <header>
            <h1 class="main_head">hj</h1>
        </header>

        <hr />

        <div class="container left">
            <img src="images/1.jpg" alt="image" />
            <article class="text css3-3 css3-4">
                <h1><a href="#" class="css3-3 css3-4">space1</a>    </h1>
            </article>
        </div>

        <div class="container right">
            <img src="images/2.jpg" alt="image" />
            <article class="text css3-4">
                <h1><a href="#" class="css3-4">space2</a></h1>
            </article>
        </div>

        <hr />

    </div>

</body>
</html>

CSS

 * {
        margin: 0;
        padding: 0;
    }

    body {
    }

    .wrapper {
        margin: 0 auto;
        width: 960px;
        padding: 30px;
        position: relative;
    }

    .left {
        float: left;
    }

    .right {
        float: right;
    }

    hr {
        border: none;
        width: 100%;
        height: 7px;
        margin: 10px 0 10px 0;
        clear: both;
    }

    a {
        text-shadow: 1px 1px #efefef;
        text-decoration: none;
    }

    b {
        text-shadow: 1px 1px #efefef;
        text-decoration: none;
    }

    header h1.main_head {
        font: 36px/18px Georgia, Arial, sans-serif;
        color: #838383;
        text-shadow: 1px 1px #efefef;
        text-align: center;
        padding: 20px 0 20px 0;
    }


    .container {
        border: 10px solid #fff;
        position: relative;
        overflow: hidden;
        height: 200px;
        -webkit-box-shadow: 0 0 3px #000;
        -moz-box-shadow: 0 0 3px #000;
        box-shadow: 0 0 3px #000;
        -webkit-transition: all .5s ease-out;
        -moz-transition: all .5s ease-out;
        transition: all .5s ease-out;
    }

        .container:hover {
            cursor: pointer;
            -webkit-box-shadow: 0 0 10px #000;
            -moz-box-shadow: 0 0 10px #000;
            box-shadow: 0 0 10px #000;
        }



    .container2 {
        border: 10px solid #fff;
        position: relative;
        overflow: hidden;
        height: 200px;
        -webkit-box-shadow: 0 0 3px #000;
        -moz-box-shadow: 0 0 3px #000;
        box-shadow: 0 0 3px #000;
        -webkit-transition: all .5s ease-out;
        -moz-transition: all .5s ease-out;
        transition: all .5s ease-out;
    }

        .container2:hover {
            cursor: pointer;
            -webkit-box-shadow: 0 0 10px #000;
            -moz-box-shadow: 0 0 10px #000;
            box-shadow: 0 0 10px #000;
        }

    .text {
        background: rgba(0,0,0,0.5);
        color: white;
        font: 14px Georgia,serif;
        height: 80px;
        width: inherit;
        position: absolute;
    }

        .text a {
            color: #fff;
            display: block;
            padding: 15px;
            font-size: 16px;
            font-weight: normal;
            text-shadow: none;
            text-decoration: none;
            width: 400px;
        }



    /* CSS3 Right Effect */
    article.css3-3 {
        right: -400px;
        top: 0;
        -webkit-transition: all .5s ease-out;
        -moz-transition: all .5s ease-out;
        -o-transition: all .5s ease-out;
        transition: all .5s ease-out;
        width: 400px;
    }

    .text a.css3-3 {
        -webkit-transition: all .4s ease-out;
        -moz-transition: all .4s ease-out;
        -o-transition: all .5s ease-out;
        transition: all .4s ease-out;
    }

        .text a.css3-3:hover {
            color: #d0206a;
            text-decoration: none;
        }

    .container:hover article.css3-3 {
        right: 0;
    }

    /* CSS3 Left Effect */
    article.css3-4 {
        left: -400px;
        bottom: 0;
        -webkit-transition: all .5s ease-out;
        -moz-transition: all .5s ease-out;
        -o-transition: all .5s ease-out;
        transition: all .5s ease-out;
        width: 400px;
    }

    .text a.css3-4 {
        -webkit-transition: all .4s ease-out;
        -moz-transition: all .4s ease-out;
        -o-transition: all .5s ease-out;
        transition: all .4s ease-out;
    }

        .text a.css3-4:hover {
            color: #d0206a;
            text-decoration: none;
        }

    .container:hover article.css3-4 {
        left: 0;
    }

也许我理解不正确,但是this是你要找的吗?

        <div class="container right">

            <img src="http://placehold.it/350x150" alt="image" />
            <article class="text css3-4">
                    <h1><a href="#" class="css3-4">space1</a></h1>
            </article>
            <article class="text css3-3 css3-4">
                    <h1><a href="#" class="css3-3 css3-4">space2</a>    </h1>
            </article>
        </div>