如何在 html 中缩放图像的一部分



我想在html中缩放图像的一部分。为了在 html 中仅显示图像的一部分,我在第一条注释中编写了一段代码。我想缩放这个显示的部分。我该怎么做。

<!DOCTYOE html>
<html>
<head>
    <style>
        .container {
            position: relative;
        }
        #clip {
            position: absolute;
            clip: rect(0, 120, 80px, 0);
            /* clip: shape(top, right, bottom, left); NB 'rect' is the only available option */
        }
        </div>
    </style>
</head>
<div class="container"> <img src="images10.png" /> </div>
<div class="container"> <img id="clip" src="images10.png" /> </body>
</html>

您可以尝试以下代码,该代码将缩放指定部分:

#clip { zoom: 150%; }

仅供参考:更多信息在这里

最新更新