STUDY/Trouble Shooting๐จ
[css] input ํ๊ทธ ์๋์์ฑ ์ ๋ฐฐ๊ฒฝ ํ๋์์ผ๋ก ๋ณ๊ฒฝ๋๋ ์ด์ ํด๊ฒฐ
JUNGY00N
2023. 8. 28. 23:52
issue
ํ์๊ฐ์
๊ธฐ๋ฅ์ ๊ตฌํํ๋ ์ค์ด๋ค.
์ด๋ฉ์ผ์ ์์ฑํ๋ input ํ๊ทธ์ ๋ฐฐ๊ฒฝ์ ๊ธฐ๋ณธ๊ฐ์
๊ฐ์ฅ ์ ์ฌ์ง์ฒ๋ผ ์ค์ ํด๋จ๋ค. (whitesmoke, ์๋ฌด๊ฒ๋ ์
๋ ฅ์ํ์ ๋)
๊ทธ๋ฅ ์
๋ ฅํ๋ฉด ๋๋ฒ์งธ ์ฌ์ง์ฒ๋ผ ์๋ ๋ฐฐ๊ฒฝ์์ผ๋ก ๋์ค๋๋ฐ,
์๋์
๋ ฅ์ ํ๊ฒ๋๋ฉด ์ธ๋ฒ์งธ ์ฌ์ง์ฒ๋ผ ๋ฐฐ๊ฒฝ์ด ํ๋์์ผ๋ก ๋์จ๋ค.
issue ์์ธ
- ํฌ๋กฌ๊ณผ ์ผ๋ถ ๋ค๋ฅธ ์น ๋ธ๋ผ์ฐ์ ๋ค์ ์ฌ์ฉ์์ ์ ๋ ฅ ์ด๋ ฅ์ ๊ธฐ๋ฐ์ผ๋ก input ํ๋์ ์๋์์ฑ(Autocomplete)์ ์ ์ํ ๋ :-webkit-autofill ์คํ์ผ์ !important๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ฉํด๋์๊ธฐ ๋๋ฌธ์ background-color, background-image, color ๋ฑ์ ์คํ์ผ๋ง์ด ์ด๋ ต๋ค.
- ์ด๋ ๊ฒ ์ ์๋ ์๋์์ฑ ํญ๋ชฉ์ ์ฌ์ฉ์๊ฐ ์ ํํ๋ฉด input ํ๋์ ๋ฐฐ๊ฒฝ์์ด ํ๋์์ผ๋ก ๋ฐ๋๋๋ฐ, ์ด๊ฒ์ ์ฌ์ฉ์์๊ฒ ํด๋น ์ ๋ ฅ์ด ์๋์์ฑ์ ํตํด ์ฑ์์ก์์ ์๊ฐ์ ์ผ๋ก ์๋ ค์ฃผ๋ ๋ฐฉ๋ฒ์ด๋ค.
issue ํด๊ฒฐ
-webkit-
์ ๊ตฌ๊ธ, ์ฌํ๋ฆฌ ๋ธ๋ผ์ฐ์ ์ ์ ์ฉ๋๋ค.:autofill
์ ์๋์์ฑ ์์ ์คํ์ผ์ ์ ์ฉํ๋ ์์ฑ์ด๋ค.!important
๋ ๋ธ๋ผ์ฐ์ ์ ๊ธฐ๋ณธ ์คํ์ผ๋ณด๋ค ์ด ์คํ์ผ์ด ์ฐ์ ์ ๋๋๋ก ํ๋ค.
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 500px whitesmoke inset !important;
}
์์ฒ๋ผ input ํ๊ทธ์ box-shadow ๋ฅผ ์ค์ ํด์ฃผ๋ฉด ์๋์์ฑ์ ํ๋๋ผ๋ ์๋์ ์๋๋ก ๋์จ๋ค.
๊ธฐ์กด์ ์๋ ์ ์๋ก ๋ฎ์ด์์ด๊ฒ์ผ๋ก ๋ณด๋ฉด ๋๋ค.