什么是在HTML中裁剪图像的最佳方式? [英] What is the best way to crop an image in HTML?

查看:99
本文介绍了什么是在HTML中裁剪图像的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML中裁剪图片的最佳方法是什么?

What is the best way to crop an image in HTML?

这将是类似下面的内容:

It would be something like the following:

<img src="something.gif" x1="10" y1="10" x2="20" y2="20">

如果这不起作用,那我就使用GIMP。关于我如何能够以编程方式工作的任何想法?

If that doesn't work, then I'll just use GIMP. Any thoughts on how I can get this to work programmatically?

推荐答案

这就是所谓的精灵,你可以阅读这个神奇的文章 A List Apart

That's called sprites, you can read this fantastic article of A List Apart.

结束它归结为:

#panel2b {
    width:50px;
    height:30px;
    background: transparent url(test-3.jpg) -96px -200px no-repeat;
}

这篇关于什么是在HTML中裁剪图像的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆