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

CSS로 이미지 필터를 만드는 방법

<시간/>

CSS를 사용하여 흐림, 대비, 밝기와 같은 이미지 필터를 생성하기 위해 다음 코드를 실행할 수 있습니다 -

예시

<!DOCTYPE html>
<html>
   <head>
      <style>
         img {
            height: auto;
            float: left;
         }
         .contrast {
            -webkit-filter: contrast(180%);
            filter: contrast(180%);
         }
         .brightness {
            -webkit-filter: brightness(250%);
            filter: brightness(250%);
         }
         .blur {
            -webkit-filter: blur(4px);
            filter: blur(4px);
         }
      </style>
   </head>
   <body>
      <img
      src = "https://www.tutorialspoint.com/assets/videos/courses/19/images/course_19_image.png" alt = "Animation Training" width = "200" height = "200">

      <img class = "contrast"
         src = "https://www.tutorialspoint.com/assets/videos/courses/19/images/course_19_image.png" alt = "Animation Training" width = "200" height = "200">

      <img class = "brightness"
         src = "https://www.tutorialspoint.com/assets/videos/courses/19/images/course_19_image.png" alt = "Animation Training" width = "200" height = "200">
     
      <img class="blur"
         src = "https://www.tutorialspoint.com/assets/videos/courses/19/images/course_19_image.png alt = "Animation Training" width = "200" height = "200">
   </body>
</html>