HTML PNG图片透明 [英] HTML PNG image transparent

查看:52
本文介绍了HTML PNG图片透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的html正文中放置一个png图像.面临的挑战是我的背景是灰色(目前,但可以更改),而应该是透明的png背景是白色.如何告诉html将图片视为png而不是常规图片?可以将其设置为透明还是必须指定背景颜色(如果更改背景,则透明是理想的选择)?

I'm trying to put a png image in the body of my html. The challenge is that my background is grey (for now, but could change) and the png background that is supposed to be transparent is white. How do I tell html to see the image as a png and not a regular image? Can I set it to transparent or do I have to specify a background color (transparent would be ideal if I change my background)?

我的代码当前为

  <img src="{% static 'livestream/images/streamON.png' %}" alt="on" width="300" height="300">

推荐答案

透明度不是在HTML中完成的,而是图像本身的一部分.浏览器将图像显示为PNG并自动将其显示为PNG.要为图像添加透明度,您将必须使用Photoshop之类的图形编辑器来编辑文件.

Transparency is not done in HTML, but is a part of the image itself. The browser will see the image as a PNG and display it as a PNG automatically. To add transparency to the image, you will have to edit the file with a graphics editor like Photoshop.

这篇关于HTML PNG图片透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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