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

CSS로 지정된 속성을 가진 요소를 선택하는 방법

<시간/>

속성이 있는 요소를 선택하려면 CSS [속성] 선택기를 사용하세요.

예를 들어, alt 속성 또는 대상 속성 등

CSS[속성] 선택기를 구현하기 위해 다음 코드를 실행할 수 있습니다.

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         img[alt] {
            border: 3px solid orange;
         }
      </style>
   </head>
   <body>
      <img src = "https://www.tutorialspoint.com/videotutorials/images/tutor_connect_home.jpg" height="200" width="200">
      <img src = "https://www.tutorialspoint.com/videotutorials/images/tutorial_library_home.jpg" height="200" width="200" alt="Tutorials Library">
   </body>
</html>