CSS

[CSS] input 태그 안의 타입(type)을 선택하려면?

해봄코딩 2023. 1. 24. 16:10

CSS에서  input 태그안의 타입을 선택하려면 어떻게 해야 하나요? 

대괄호를 ( [ ] ) 쓰고 이 안에 타입명을 쓰면 됩니다. 

 

 

구문

input[type=타입명] { 
  /* 스타일 내용 */
}

* input에 정의할 수 있는 타입명 : button, password, text등 많습니다. 자세한 input  type에 대해 알고 싶으시면 아래를 참고하셔요! 
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input

 

 

예시

input[type=text] {
    font-family: Arial, sans-serif;
}
  input[type=text], input[type=password] {
      width: 100%;
      padding: 15px;
      margin: 5px 0 22px 0;
      display: inline-block;
      border: none;
      background: #f1f1f1;
}

 

'CSS' 카테고리의 다른 글

[CSS] width나 height의 나머지 공간을 채우려면?  (0) 2023.02.21
[CSS] display : none vs visibility: hidden  (0) 2023.02.16
[CSS] ::after에 대해서  (1) 2023.01.19
[CSS] :root 가상 클래스  (0) 2023.01.03
CSS : z-index에 대해서  (0) 2022.12.06