티스토리 뷰

1. input type="file" 이미지 화

label { display: inline-block; cursor: pointer;}
input { overflow: hidden; position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0, 0, 0, 0);}

<label for="file"><img src="image.png" alt="파일찾기"></label>
<input type="file" id="file">

 

2. input type="checkbox" 이미지 화

.checkbox { display:none; }
.checkbox +label { display: inline-block; height:19px; padding-left: 26px; line-height: 22px; background: url(ico_checkbox.png) no-repeat; cursor: pointer;}
.checkbox:checked +label { background-position: 0 -21px;}

<input type="checkbox" id="box1" class="checkbox"><label for="box1">클릭하면 체크박스 이미지가 나타납니다.</label>

'HTML > CSS' 카테고리의 다른 글

CSS로 PC, Mobile 구분  (0) 2022.05.11
sass 정리  (0) 2021.08.26
CSS 네이밍 규칙  (0) 2021.02.26
animation, transition, transform 속성 정리  (0) 2021.01.05
잘 사용하지 않지만 유용한 CSS 속성  (0) 2020.12.10
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
글 보관함