다음은 CSS로 반응형 이미지를 만드는 코드입니다 −
예시
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
img {
width: 100%;
max-width: 1000px;
}
</style>
</head>
<body>
<h1>Responsive Images Example</h1>
<h2>Resize the window to see responsive image scale up and down</h2>
<img src="https://images.pexels.com/photos/34950/pexels-photo.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940">
</body>
</html> 출력
위의 코드는 다음 출력을 생성합니다 -

브라우저 크기를 조정하면 이미지가 다음과 같이 축소됩니다 -
