我正在尝试剪辑一张照片,但我希望照片处于相同的位置,就好像它没有剪辑一样。问题在于你需要一个位置:css中的绝对属性,然后覆盖数据。
例如:
<html>
<head>
<style>
img {
position: absolute;
clip: rect(0px,60px,200px,0px);
}
</style>
</head>
<body>
<img src="w3css.gif" width="100" height="140">
this is some text
</body>
</html>
此代码用剪切的图像覆盖“这是一些文本”文本。
所以我想要一个剪裁的图像,但文字不被遮盖。
答案 0 :(得分:3)
这是因为你没有给出topoffset
值。
img {
position: absolute;
clip: rect(20px,60px,200px,0px);
}
clip: rect(top offset, visible width, visible height, left offset)