博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
怎么对png文件设置渐变_使用pngtocss将PNG转换为CSS渐变
阅读量:2517 次
发布时间:2019-05-11

本文共 2523 字,大约阅读时间需要 8 分钟。

怎么对png文件设置渐变

are a hot topic right now and why shouldn't they be? CSS gradients save time by not making you create an image, they save a request to that image, and the code to create them is smaller than the image's file size.  If you've been using image-based gradients and are looking to move your web apps to CSS-based gradients, there's a great new project aimed at automating PNG gradients into CSS gradients called pngtocss.  pngtocss is easy to obtain, configure, and use!

现在是一个热门话题,为什么不应该呢? CSS渐变通过不创建图像来节省时间,它们将请求保存到该图像,并且创建它们的代码小于图像的文件大小。 如果您一直在使用基于图像的渐变,并且希望将您的Web应用程序移动到基于CSS的渐变,那么有一个伟大的新项目旨在将PNG渐变自动转换为称为pngtocss CSS渐变。 pngtocss易于获取,配置和使用!

下载和配置 (Download and Configuration)

The pngtocss project is , for your forking pleasure.  You can go the GitHub and download a zip or simply clone the project to your machine:

pngtocss项目 ,以供您欣赏。 您可以转到GitHub并下载一个zip或简单地将项目克隆到您的计算机上:

git clone https://github.com/bluesmoon/pngtocss.git

One you've cloned the repo, navigate to the src directory where you'll find a pngtocss.c file, which you'll have to make. Before making pngtocss, you must confirm that your system has the zlib and libpng libraries installed.  I use MacPorts so I typed:

一个你克隆回购,浏览到src目录,你会发现一个pngtocss.c file ,你就必须make 。 在制作pngtocss之前,必须确认系统已安装zliblibpng库。 我使用MacPorts,所以输入:

sudo port install zlibsudo port install libpng

With those two libraries present, I was ready to make:

在存在这两个库的情况下,我准备make

make pngtocss.c

If everything installed as it should have, you're ready to start converting PNG gradients to CSS gradients!  To convert your PNG gradient images into CSS gradients, run the following command:

如果一切都已安装,您就可以开始将PNG渐变转换为CSS渐变了! 要将PNG渐变图像转换为CSS渐变,请运行以下命令:

#pngtocss {file}pngtocss mypng.png#output:.mypng {	background-image: -moz-linear-gradient(top, #02469a, #bcf3cb);	background-image: -webkit-gradient(linear, left top, left bottom, from(#02469a), to(#bcf3cb));	background-image: -webkit-linear-gradient(top, #02469a, #bcf3cb);	background-image: -o-linear-gradient(top, #02469a, #bcf3cb);	background-image: linear-gradient(top, #02469a, #bcf3cb);}

That's it!  Pretty sweet!  Like any early project, however, pngtocss isn't perfect and it doesn't support radial gradients yet. pngtocss is, however, a promising start and is an excellent utility for helping developers move from images to CSS.  Cheers to Phillip Tellis for creating this awesome utility!

而已! 真可爱! 但是,像任何早期项目一样, pngtocss是完美的,它还不支持径向渐变。 pngtocss是一个有前途的起点,并且是一个出色的实用程序,可帮助开发人员将图像从图像转移到CSS。 感谢Phillip Tellis创建这个超赞的实用程序!

翻译自:

怎么对png文件设置渐变

转载地址:http://zfvwd.baihongyu.com/

你可能感兴趣的文章
[C#-SQLite] SQLite一些奇怪的问题
查看>>
Map的遍历
查看>>
hibernate中cache二级缓存问题
查看>>
My third day of OpenCV
查看>>
Java并发计数器探秘
查看>>
特色博客
查看>>
[Python] RuntimeError: Invalid DISPLAY variable
查看>>
Android的View和ViewGroup分析
查看>>
淘宝爆款详情页制作的几个方法(理论)
查看>>
c语言单链表实现
查看>>
php无限极分类
查看>>
08——别让常逃离析构函数
查看>>
echarts.js中的图表大小自适应
查看>>
Linux总结
查看>>
llg的农场(farm)
查看>>
Delphi的FIFO实现
查看>>
Anti StrongOD Kernel Mode
查看>>
bootstrap字体图标在谷歌显示正常,在火狐显示异常的问题
查看>>
Luogu CF22C 【System Administrator】
查看>>
【原】使用less实现随机下雪动画
查看>>