input
- type์ ๋ฐ๋ผ์ ๋ค์ํ ์คํ์ผ์ ๊ฐ์ง๋ค. ex) type=”password”
- input ์์๋ฅผ css ์ ์ฉํ๋ฉด ๋ชจ๋ input์ ์คํ์ผ์ ์ ์ฉ๋๋๊น class๋ก ์ง์ ํด์ค์ผํ๋ค.
<input type="text" class="input--text" placeholder="Search GitHub">
/* ์
๋ ฅ์์ */
.input--text{
height: 34px;
padding: 0 10px;
border : 1px solid #ddd;
border-radius:5px;
box-sizing:border-box;
outline:none;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
font-size:16px;
}
- box-sizing:border-box; height์ padding์ผ๋ก ์์๊ฐ ์ ์ ๋์ด๋๋ ๊ฒ์ ๋ง๋๋ค.
- outline:none; ํ ๋๋ฆฌ ์ฌ์ฉํ์ง ์๊ฒ ๋ค.
- box-shadow: inset 0 1px 2px rgba(0,0,0,0.075); ๋ด๋ถ๋ก ๋ค์ด๊ฐ ๊ฒ์ ์ ๊ทธ๋ฆผ์ 7.5%์ ํฌ๋ช ๋
#outline
- input ์์ ํด๋ฆญํ๋ฉด focus๋์๋ค๋ ์๋ฏธ๋ก ํ ๋๋ฆฌ(outline)๊ฐ ์๊ธด๋ค. (default)
- border๋ณด๋ค outline์ ์ ์ ์ฐ๋ ์ด์ ๋ ์ ์ดํ๊ธฐ ์ด๋ ต๊ธฐ ๋๋ฌธ์ด๋ค.
# inset ํค์๋
- ์ํฉ. ๊ทธ๋ฆผ์๊ฐ ๋ฐ์ค์ ์ธ๋ถ๊ฐ ์๋ ๋ฐ์ค์ ๋ด๋ถ์ ์๊ธฐ๊ฒ ๋ง๋ค๊ณ ์ถ๋ค.
- box-shadow ์์ฑ ๋งจ ์์ inset ํค์๋๋ฅผ ๋ถ์ด๋ฉด ๊ทธ๋ฆผ์๊ฐ box์ ์์ผ๋ก ๋ค์ด๊ฐ๋ค.
.input--text:focus{
border-color: #51a7e8;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.075) ,
0 0 5px rgba(81,167,232,0.5);
}
- โญ : focus ๊ฐ์ ํด๋์ค ์ ํ์
input ๋ถ๋ถ์ ํฌ์ปค์ค ๋ ์ํ๋ฅผ ํ๋์์ผ๋ก ์ ์
- border-color: #51a7e8;
--> focus ์ํ์์๋ #51a7e8 (ํ๋์) ์ผ๋ก ๋ณ๊ฒฝ
--> focus ๋น ์ ธ๋๊ฐ๋ฉด ๋ค์ ์๋ ์์ ๋์๊ฐ๋ค.
- inset 0 1px 2px rgba(0,0,0,0.075) ,
0 0 5px rgba(81,167,232,0.5);
--> ,(์ผํ)๋ฅผ ํตํด์ ๊ทธ๋ฆผ์๋ฅผ ๋ค์ค์ผ๋ก ๋ฃ์ด ์ค ์ ์๋ค.
--> ๊ธฐ์กด์ ์์ชฝ ๊ทธ๋ฆผ์๋ฅผ ๊ทธ๋๋ก ๋๊ณ ๋ฐ๊นฅ์ชฝ ๊ทธ๋ฆผ์๊น์ง ์ถ๊ฐ๋๋ ํํ
'side-project > GitHub ๋ฐ๋ผ ๋ง๋ค๊ธฐ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] a ํ๊ทธ ํด๋ฆญ ๋ฒ์ ํ์ฅ์ํค๊ธฐ (0) | 2022.04.06 |
---|---|
[CSS] ์์ ์์ ๊ฐ์ด๋ฐ ์ ๋ ฌ ๋ฐ ์์ง ์ ๋ ฌ (0) | 2022.04.05 |
[CSS] ํฅ์ค์ฝ๋ ์์, Color Picker (0) | 2022.04.04 |
[CSS] Vendor Prefix (๋ธ๋ผ์ฐ์ ์ ์ฒด๋ณ ์ ๋์ฌ) (0) | 2022.03.24 |
[CSS] ๋ฒํผ ๋ง๋ค๊ธฐ (0) | 2022.03.21 |
๋๊ธ