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 |
|---|---|---|
| 2217 | 2026. 02. 11. | 모던 CSS: Container Queries와 :has() 선택자 실전 활용 |
| 2181 | 2026. 02. 11. | Web Components 실전: Shadow DOM과 Custom Elements |
| 2180 | 2026. 02. 11. | 반응형 이미지 최적화: srcset, picture, 그리고 AVIF |
| 2179 | 2026. 02. 11. | CSS Nesting과 @scope: 네이티브 CSS의 진화 |
| 2178 | 2026. 02. 11. | 웹 접근성(a11y) 실전 체크리스트 2025 |
| 2177 | 2026. 02. 11. | View Transitions API로 SPA 수준의 페이지 전환 |
| 2176 | 2026. 02. 11. | CSS Anchor Positioning: 툴팁과 드롭다운의 혁신 |
| 2175 | 2026. 02. 11. | HTML Dialog 요소와 Popover API 완전 가이드 |
| 2174 | 2026. 02. 11. | CSS Grid Subgrid: 복잡한 레이아웃의 해결사 |
| 2173 | 2026. 02. 11. | :has() 선택자로 JavaScript 없이 인터랙션 구현하기 |