[CSS] boxshadow/table/form/transform/transition

XIXIยท2022๋…„ 5์›” 13์ผ
0

๋Œ€๊ตฌAI์Šค์ฟจ

๋ชฉ๋ก ๋ณด๊ธฐ
16/57
post-thumbnail

๐ŸŒฑ ํ•™์Šตํ•œ ๋‚ด์šฉ

โœ๏ธboxshadow

<style>
        div{
            width: 600px; 
            height: 250px;
            background: url(../0511/image/bottom-bg.jpg) no-repeat;
            border: 1px solid #ccc;
        }

        #example1{box-shadow: 5px 10px ;}

        /* ์ƒ‰ ๋ณ€๊ฒฝ */
        #example2{box-shadow: 5px 10px #888;}

        /* ๊ทธ๋ฆผ์ž ๋ฒˆ์ง€๊ธฐ */
        #example3{box-shadow: 5px 10px 10px skyblue;}

        /* ๊ทธ๋ฆผ์ž ์ค‘์ฒฉ ๊ฐ€๋Šฅ, ์ฝค๋งˆ๋ฅผ ์‚ฌ์šฉ */
        #example4{
            box-shadow: 2px 2px 2px black,
                        0   0   25px blue;
        }

        #example5{box-shadow: 5px 5px 5px 5px rgb(202, 202, 202) inset;}
</style>

box-shadow
๊ฐ€๋กœ | ์„ธ๋กœ | ๋ฒˆ์ง | ์ƒ‰

  • box-shadow โžช ๊ทธ๋ฆผ์ž
  • box-shadow: inset โžช ๋‚ด๋ถ€๊ทธ๋ฆผ์ž
<body>
    <div id="example1"></div>
    <br><br>
    <div id="example2"></div>
    <br><br>
    <div id="example3"></div>
    <br><br>
    <div id="example4"></div>
    <br><br>
    <div id="example5"></div>
    <br><br>    
</body>

boxshadow

โœ๏ธtable

<style>
        table{
             /* border: 1px solid blue; */
            border-collapse: collapse;  /*ํ‘œ ๋ผ์ธ ํ•ฉ์น˜๊ธฐ*/
        }

        td, th{
            /* border: 1px dotted green; */
            width: 100px;
            height: 20px;
            padding: 10px;
            text-align: left;
        }

        thead, tfoot{
            background: darkgrey;
            color:aliceblue;
        }

        td, tfoot th{border-bottom: 1px solid darkgray;}

        tbody tr:nth-child(2n){background: aliceblue;}

        tbody tr:hover{background: pink;}
        
        caption{
            caption-side: top;
            line-height: 2;
        }
</style>

border
๊ตต๊ธฐ | ์„ ์†์„ฑ | ์ƒ‰์ƒ

  • border-collapse: โžช ํ‘œ ๋ผ์ธ ํ•ฉ์น˜๊ธฐ
  • tbody tr:nth-child(2n): โžช nth ์ง์ˆ˜์„ ํƒ
  • caption-side: โžช ์บก์…˜ ์œ„์น˜
<body>
    <table>
        <caption>1 ํ•™๊ธฐ ์„ฑ์ </caption>
        <thead>
            <tr>
                <th>์ด๋ฆ„</th>
                <th>HTML</th>
                <th>CSS</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>์‚ฌ๊ณผ</td>
                <td>80</td>
                <td>70</td>
            </tr>
            <tr>
                <td>๋ฐ”๋‚˜๋‚˜</td>
                <td>90</td>
                <td>60</td>
            </tr>
            <tr>
                <td>๋”ธ๊ธฐ</td>
                <td>70</td>
                <td>75</td>
            </tr>
            <tr>
                <td>์‚ฌ๊ณผ</td>
                <td>80</td>
                <td>70</td>
            </tr>
            <tr>
                <td>๋ฐ”๋‚˜๋‚˜</td>
                <td>90</td>
                <td>60</td>
            </tr>
            <tr>
                <td>๋”ธ๊ธฐ</td>
                <td>70</td>
                <td>75</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <th>ํ•ฉ๊ณ„</th>
                <th>300</th>
                <th>270</th>
            </tr>    
        </tfoot>
    </table>
</body>

table

โœ๏ธformstyle

<style>
        input[type=text]{color: red;}

        input:hover, textarea:hover{background-color: aliceblue;}

        input[type=text]:focus, input[type=email]:focus{font-size: 120%;}

        label{
            display: block; /*์†์„ฑ ๋ณ€๊ฒฝ*/
            padding: 5px;
        }

        label span{
            display: inline-block; /*์ธ๋ผ์ธ+๋ธ”๋Ÿญ ์†์„ฑ */
            width: 90px;
            text-align: right;
            padding: 10px;
        }
</style>
  • block โžช ํ•œ์ค„์„ ์ฐจ์ง€ํ•˜๋Š” ์†์„ฑ
  • inline-block โžช inline์†์„ฑ + ๊ณต๊ฐ„ ์†์„ฑ
<body>
    <h3>CONTACT US</h3>
    <hr>
    <form>
        <label>
            <span>Name</span><input type="text">
        </label>

        <label>
            <span>Email</span><input type="email" placeholder="abc@mail.com">
        </label>

        <label>
            <span>Commet</span>
            <textarea row="5" cols="40" placeholder="๋ฉ”์„ธ์ง€๋ฅผ ๋‚จ๊ฒจ์ฃผ์„ธ์š”"></textarea>
        </label>

        <label>
            <input type="submit" value="์ „์†ก">
        </label>
    </form>
</body>

formstyle

โœ๏ธtransform

<style>
        .origin{
            width: 200px;
            height: 134px;
            border: 1px solid black;
            margin: 40px; 
            perspective: 200px; /*์›๊ทผ๊ฐ*/
        }

        /* ์ด๋ฏธ์ง€ ์ด๋™ */
        .movex:hover{
            /* ๋‹ค๋ฅธ ์›น์‚ฌ์ดํŠธ ํ•˜์œ„ํ˜ธํ™˜์„ ์œ„ํ•ด์„œ ์จ์ค€๋‹ค */
            -webkit-transform: translateX(50px);
            -ms-transform: translateX(50px);
            -moz-transform: translateX(50px);
            -o-transform: translateX(50px);
            transform: translateX(50px);
        }

        .movey:hover{transform: translateY(50px);}
        .movexy:hover{ transform: translate(10px, 20px);}

        /* ์ด๋ฏธ์ง€ ํ™•๋Œ€, ์ถ•์†Œ(์†Œ์ˆ˜์  ์‚ฌ์šฉ, -๋Š” ๋ฐฉํ–ฅ ๋ณ€๊ฒฝ) */
        .scalex:hover{transform: scaleX(1.5);}
        .scaley:hover{transform: scaleY(1.5);}
        .scalexy:hover{transform: scale(2,2);}

        /* ๊ธฐ์šธ์ž„ - ๊ฐ๋„ */
        .skewx:hover{transform: skewX(10deg);}
        .skewy:hover{transform: skewY(20deg);}
        .skewxy:hover{transform: skew(30deg, -30deg);}

        /* ํšŒ์ „ */
        .rot:hover{transform: rotate(20deg);}

        /* 3์ฐจ์› */
        .rotx:hover{transform: rotateX(45deg);}
        .roty:hover{transform: rotateY(45deg);}
        .rotz:hover{transform: rotateZ(45deg);}
        .rotxyz:hover{transform: rotate3d(2.5, 1.2, -1.5, 45deg);}
    </style>
  • transform: translateX() โžช X์ถ•์œผ๋กœ ()์ด๋™
  • transform: translateY() โžช Y์ถ•์œผ๋กœ ()์ด๋™
  • transform: translate( , ) โžช X์ถ•์œผ๋กœ, Y์ถ•์œผ๋กœ
  • transform: scaleX() โžช X์ถ•์œผ๋กœ ํฌ๊ธฐ ๋ณ€ํ˜•
  • transform: scaleY() โžช Y์ถ•์œผ๋กœ ํฌ๊ธฐ ๋ณ€ํ˜•
  • transform: scale( , ) โžช X์ถ• ํฌ๊ธฐ ๋ณ€ํ˜•, Y์ถ• ํฌ๊ธฐ ๋ณ€ํ˜•
  • transform: skewX() โžช X์ถ•์œผ๋กœ ๊ธฐ์šธ์ž„ ๊ฐ๋„
  • transform: skewY() โžช Y์ถ•์œผ๋กœ ๊ธฐ์šธ์ž„ ๊ฐ๋„
  • transform: skew() โžช X์ถ• ๊ธฐ์šธ์ž„ ๊ฐ๋„, Y์ถ• ๊ธฐ์šธ์ž„ ๊ฐ๋„
  • transform: rotate() โžช ํšŒ์ „
  • transform: rotateX() โžช X์ถ•์œผ๋กœ 3์ฐจ์› ํšŒ์ „
  • transform: rotateY() โžช Y์ถ•์œผ๋กœ 3์ฐจ์› ํšŒ์ „
  • transform: rotateZ() โžช Z์ถ•์œผ๋กœ 3์ฐจ์› ํšŒ์ „
  • transform: rotate3d() โžช X, Y, Z์ถ•์œผ๋กœ 3์ฐจ์› ํšŒ์ „

3์ฐจ์› ๊ฒฝ์šฐ perspective: ์›๊ทผ๊ฐ ๊ฐ’์ด ์žˆ์–ด์•ผ ํ•จ.

<body>
    <p>์ด๋ฏธ์ง€ ์ด๋™</p>
    <div class="origin">
        <div class="movex">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="movey">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="movexy">
            <img src="./img/bus.jpg">
        </div>
    </div>

    <p>์ด๋ฏธ์ง€ ํ™•๋Œ€, ์ถ•์†Œ(์†Œ์ˆ˜์  ์‚ฌ์šฉ, -๋Š” ๋ฐฉํ–ฅ ๋ณ€๊ฒฝ)</p>
    <div class="origin">
        <div class="scalex">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="scaley">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="scalexy">
            <img src="./img/bus.jpg">
        </div>
    </div>

    <p>๊ธฐ์šธ์ž„ - ๊ฐ๋„ </p>
    <div class="origin">
        <div class="skewx">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="skewy">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="skewxy">
            <img src="./img/bus.jpg">
        </div>
    </div>

    <p>ํšŒ์ „</p>
    <div class="origin">
        <div class="rot">
            <img src="./img/bus.jpg">
        </div>
    </div>
    
    <p>3์ฐจ์›</p>
    <div class="origin">
        <div class="rotx">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="roty">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="rotz">
            <img src="./img/bus.jpg">
        </div>
    </div>
    <div class="origin">
        <div class="rotxyz">
            <img src="./img/bus.jpg">
        </div>
    </div>
</body>

โœ๏ธtransform-origin

<style>
        .origin{
            width: 200px;
            height: 134px;
            border: 1px solid black;
            margin: 40px; 
            perspective: 200px; /*์›๊ทผ๊ฐ*/
        }

        .bus{transform: rotatez(10deg);}

        /* ์ด๋ฏธ์ง€ ๋ณ€ํ™˜ ์‹œ์ž‘์  ์ง€์ •ํ•˜๊ธฐ */
        .ltop .bus{transform-origin: left top;}
        .rtop .bus{transform-origin: right top;}
        .lbottom .bus{transform-origin: left bottom;}
        .rbottom .bus{transform-origin: right bottom;}

</style>
  • transform-origin โžช ์ด๋ฏธ์ง€ ๋ณ€ํ™˜ ์‹œ์ž‘์  ์ง€์ •ํ•˜๊ธฐ
  • left top โžช ์™ผ์ชฝ ์ƒ๋‹จ ๊ณ ์ • ๋ณ€ํ™˜
  • right top โžช ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ ๊ณ ์ • ๋ณ€ํ™˜
  • left bottom โžช ์™ผ์ชฝ ํ•˜๋‹จ ๊ณ ์ • ๋ณ€ํ™˜
  • right bottom โžช ์˜ค๋ฅธ์ชฝ ํ•˜๋‹จ ๊ณ ์ • ๋ณ€ํ™˜
<div class="origin">
	<div class="ltop">
		<img src="./img/bus.jpg" class="bus">
	</div>
</div>
<div class="origin">
	<div class="rtop">
		<img src="./img/bus.jpg" class="bus">
	</div>
</div>
<div class="origin">
	<div class="lbottom">
		<img src="./img/bus.jpg" class="bus">
	</div>
</div>
<div class="origin">
	<div class="rbottom">
		<img src="./img/bus.jpg" class="bus">
	</div>
</div>

transform-origin

โœ๏ธbackface-visibility

<style>
        h1{font-size: 60px;}

        div{
            width: 200px;
            height: 200px;
        }

        .container{
            border: 1px solid black;
            perspective: 300px;  /*์›๊ทผ๊ฐ*/
            margin-top: 100px;
            margin-left: 100px;
            float: left;
        }

        .box{
            background-color: aquamarine;
            transform: rotateY(135deg);
        }

        /* ๋’ท ๋ฉด ๋ณด์ผ๋ž˜ ๋ง๋ž˜ */
        #back1{backface-visibility: hidden;}
        #back2{backface-visibility: visible;}
</style>
  • backface-visibility: hidden โžช ์ˆจ๊น€
  • backface-visibility: visible โžช ๋ณด์—ฌ์คŒ
<body>
    <div class="container">
        <div class="box" id="back1">
            <h1>Back1</h1>
        </div>
    </div>

    <div class="container">
        <div class="box" id="back2">
            <h1>Back1</h1>
        </div>
    </div>
</body>

โœ๏ธtransition

<style>
        /* ์ „ํ™˜ ํ”„๋กœํผํ‹ฐ, ์ „ํ™˜์‹œ๊ฐ„ */
        span{transition: font-size 3s;}
        span:hover{font-size: 500%;}
</style>
  • transition: โžช ์ „ํ™˜
    transition-property ์œ ํ˜•
    transform, width, height, background-color ๋“ฑ
<body>
    <p><span>๊ฝ!</span>๊ธ€์ž์— ๋งˆ์šฐ์Šค๋ฅผ ์˜ฌ๋ ค๋ณด์„ธ์š”</p>
</body>
profile
Life is experience:)

0๊ฐœ์˜ ๋Œ“๊ธ€