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 |
|---|---|---|
| 2172 | 2026. 02. 11. | CSS Container Queries 실전 활용 가이드 |
| 2063 | 2025. 11. 30. | HTML Form 유효성 검사 |
| 2062 | 2025. 11. 30. | BEM 방법론 - CSS 클래스 네이밍 |
| 2061 | 2025. 11. 30. | SCSS/SASS 기초와 활용 |
| 2060 | 2025. 11. 30. | 웹 접근성(A11y) 체크리스트 |
| 2059 | 2025. 11. 30. | CSS 애니메이션과 Transition |
| 2058 | 2025. 11. 30. | CSS 변수(Custom Properties) 활용 |
| 2057 | 2025. 11. 30. | 반응형 웹 디자인 - Media Query 활용 |
| 2056 | 2025. 11. 30. | CSS Grid 레이아웃 마스터 |
| 2055 | 2025. 11. 30. | CSS Flexbox 완전 정복 |