Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS의 역할:선택적 선택기

<시간/>

CSS :선택적 선택기를 사용하여 "필수" 속성이 없는 요소

스타일 지정

예시

다음 코드를 실행하여 :optional 선택기를 구현할 수 있습니다.

<!DOCTYPE html>
<html>
   <head>
      <style>
         input:optional {
            background-color: blue;
         }
      </style>
   </head>
   <body>
      <form>
         Subject: <input type = "text" name = "subject"><br>
         Student: <input type = "text" name = "student" required><br>
      </form>
   </body>
</html>