116강. opacity 적용

2019. 2. 12. 20:44Front End 강의내용

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

    <style>

        *{

            padding: 0px;

            margin: 0px;

        }

        .carousel-container{

            height: 60vh;

        }

        .carousel-container img{

            width: 100%;

            position: absolute;

            height: 60vh;

            opacity: 0; 

            /*            opacity 핵심 */

            transition: all 1s;

        }

        .controller{

            width: 80%;

            margin-top: 20px auto;

        }

        .controller a{

            display: inline-block;

            background-color: tan;

            width: 30%;

            height: 80px;

            margin: 10px;

            background-size: cover; 

            /*            안에 딱 맞게 */

        }

        .controller #c1{

            background-image: url(img/1.jpg)

        }

        .controller #c2{

            background-image: url(img/2.jpg)

        }

        .controller #c3{

            background-image: url(img/3.jpg)

        }

        img:target{

            opacity: 1;

            /*            opacity 핵심 */

        }

    </style>

</head>

<body>

    <div class="carousel-container">

        <img src="img/1.jpg" alt="" id="one">

        <img src="img/2.jpg" alt="" id="two">

        <img src="img/3.jpg" alt="" id="three">

    </div>

    <div class="controller">

        <a href="#one" id="c1"></a>

        <a href="#two" id="c2"></a>

        <a href="#three" id="c3"></a>

    </div>

</body>

</html>