๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ณต๋ถ€/HTML&CSS

[ex12~13] CSS(background)

ex12

            HTML/CSS
            - ์ผ€๋ฐฅ ํ‘œ๊ธฐ๋ฒ• ๋งŽ์ด ์‚ฌ์šฉ
            - aaa-bbb-cc

            *** CSS์˜ ๋Œ€๋ถ€๋ถ„์˜ ์†์„ฑ์€ ๋ชจ๋“  ํƒœ๊ทธ์— ์ ์šฉ์ด ๊ฐ€๋Šฅํ•˜๋‹ค!!!

            ๋ฐฐ๊ฒฝ
            1. ๋ฐฐ๊ฒฝ์ƒ‰
                - background-color

            2. ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€
                - background-image
            

            CSS ์ƒ‰์ƒ ํ‘œํ˜„๋ฒ•
            1. Color name: red, yellow, blue..
            2. RGB color(HEX): #FF0055
            3. RGB color(DEC): rgb(255,0,128)
            4. RGBA color(DEC): rgba(255,255,255,1)
                                a(alpha channel - ๋ถˆํˆฌ๋ช…๋„(0~1))

body {
    /* background-color: yellowgreen; */
    /* background-color: rgb(128, 0, 0); */
    /* background-color: rgba(0, 0, 255, .5); */

    background-image: url(images/cat01.jpg);
    /* background-repeat: repeat-x; ํ–‰๋ฐ˜๋ณต */
    /* background-repeat: repeat-y; ์—ด๋ฐ˜๋ณต */
    background-repeat: no-repeat;


        

            background-position
                ์ˆ˜ํ‰: left|center|right
                ์ˆ˜์ง: top|center|bottom
                ์ˆ˜์น˜(px): ์ ˆ๋Œ€์œ„์น˜
                ์ˆ˜์น˜(%): ์ƒ๋Œ€์œ„์น˜

background-position: 50% 100px;

/* attachment(๊ธฐ๋ณธ scroll) > fixed(์Šคํฌ๋กค ๋‚ด๋ ค๋„ ๊ณ ์ •) */
background-attachment: fixed;

/* background-position: center center; */

 

            <html>, <body>
            - ๋ธ”๋Ÿญ ํƒœ๊ทธ
            - ๋ธ”๋Ÿญ ํƒœ๊ทธ์˜ ์˜์—ญ
                - ๋„ˆ๋น„: 100%
                - ๋†’์ด: ๋‚ด์šฉ๋ฌผ๋งŒํผ

 


ex13
        - ๊ฒ€์ƒ‰์ฐฝ style ์„ค์ •

/* ๊ฒ€์ƒ‰์ฐฝ์— ์ด๋ฏธ์ง€ ๋„ฃ๊ธฐ */
#search {
    background-image: url(images/hangame.png);
    background-repeat: no-repeat;
    background-position: center center;
}

/* ๊ฒ€์ƒ‰์ฐฝ ํด๋ฆญํ•˜๋ฉด ๊ด‘๊ณ  ์‚ฌ๋ผ์ง */
#search:focus {
    background-image: url();
}

/* ๊ฒ€์ƒ‰์ฐฝ ํด๋ฆญํ• ๋•Œ ํ…Œ๋‘๋ฆฌ ์‚ฌ๋ผ์ง */
.data {
    outline: none;
}

/* ๊ฒ€์ƒ‰์ฐฝ ํด๋ฆญํ–ˆ์„๋•Œ ๋ฐฐ๊ฒฝ์ƒ‰ ์ง€์ •*/
.data:focus {
    background-color: yellow;
}

 

์ „์ฒด์ฝ”๋“œ

๋”๋ณด๊ธฐ
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

        #search {
            background-image: url(images/hangame.png);
            background-repeat: no-repeat;
            background-position: center center;
        }

        #search:focus {
            background-image: url();
        }

        .data {
            outline: none;
        }

        .data:focus {
            background-color: yellow;
        }

    </style>
</head>
<body>
    <!-- ex13_background.html -->

    <h1>๋„ค์ด๋ฒ„</h1>

    <input type="text" id="search">
    <input type="button" value="๊ฒ€์ƒ‰ํ•˜๊ธฐ">

    <hr>

    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>
    <input type="text" class="data"><br>

</body>
</html>

'ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๊ณต๋ถ€ > HTML&CSS' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[ex15~17] CSS(box)  (2) 2023.04.14
[ex14] CSS(text)  (0) 2023.04.14
[ex11] CSS(Emmet)  (1) 2023.04.13
[ex03~10] CSS (Selector)  (0) 2023.04.13
[ex01~02] CSS (Style Sheet)  (0) 2023.04.13