Contents
see List작성일 2015. 02. 24.
CSS Form Selector (속성 선택자)
폼 요소를 타입별로 선택할 때 사용하는 CSS 속성 선택자입니다.
기본 문법
input[type="text"]
input[type="password"]
input[type="email"]
주요 폼 선택자
/* 텍스트 입력 필드 */
input[type="text"] {
border: 1px solid #ccc;
padding: 8px;
}
/* 비밀번호 필드 */
input[type="password"] {
border: 1px solid #999;
}
/* 체크박스 */
input[type="checkbox"] {
width: 16px;
height: 16px;
}
/* 라디오 버튼 */
input[type="radio"] {
margin-right: 5px;
}
/* 제출 버튼 */
input[type="submit"],
button[type="submit"] {
background-color: #007bff;
color: white;
cursor: pointer;
}
/* 파일 업로드 */
input[type="file"] {
padding: 5px;
}
속성 선택자 종류
| [attr] | 속성이 존재하는 요소 |
| [attr=value] | 정확히 일치 |
| [attr^=value] | 시작 값 일치 |
| [attr$=value] | 끝 값 일치 |
| [attr*=value] | 포함 여부 |
활용 예시
/* 필수 입력 필드 */
input[required] {
border-left: 3px solid red;
}
/* disabled 상태 */
input:disabled {
background-color: #f5f5f5;
cursor: not-allowed;
}
/* placeholder 스타일 */
input::placeholder {
color: #999;
font-style: italic;
}html
| No | 작성일 | Title |
|---|---|---|
| 2054 | 2025. 11. 30. | HTML5 시맨틱 태그 완벽 가이드 |
| 1944 | 2024. 08. 06. | 크롬 html input 에서 자동완성 막기 |
| 1884 | 2023. 02. 24. | [ css ] width : height , 1:1 로 맞추기 |
| 1564 | 2020. 11. 29. | [ html ] 크롬 자동완성 끄기 |
| 1116 | 2016. 10. 10. | [ css ] textarea 줄바꿈 html 인식하기 |
| 337 | 2016. 01. 14. | [ jstl ] jstl 에서 현재날짜 기준으로 연산 |
| 325 | 2015. 11. 04. | [ html ] div 하단정렬 |
| 316 | 2015. 10. 12. | [ jstl ] number format ( 1000 단위 콤마, 날짜, 금액 ) |
| 314 | 2015. 08. 05. | [ CSS ] div 에 수직 정렬 ( vertical-align ) 설정하기 |
| 276 | 2015. 05. 08. | [ css ] 테이블 글자 자동으로 내려쓰기 |