CSS设置背景图像在图像是.NET程序集资源或WebResource [英] Setting CSS background-image where the image is a resource or WebResource in a .NET assembly

查看:136
本文介绍了CSS设置背景图像在图像是.NET程序集资源或WebResource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了将生活在自己的组件中的ASP.NET服务器控件。它是在应用程序,它使用CSS背景图像的东西已经是重构。

I am writing an ASP.NET server control that will live in its own assembly. It's a refactoring of something already in the app, which uses CSS background images.

我不希望要求组件的用户必须安装一个单独的图像文件夹,所以 - 如果可能的话 - 我想的图像作为资源存储在服务器控件的程序。但我还是想使用CSS将它们设置为背景图片。除非我弄错了,CSS是我设置背景图片的唯一选择。

I don't want to require the user of the assembly to have to install a separate images folder, so -- if it's possible -- I'd like to store the images as resources in the server control's assembly. But I'd still like to use CSS to set them as background images. Unless I'm mistaken, CSS is my only option for setting background images.

这可能吗?我见过的地方一些标记是表明它可能是,特别的这个,<一个href=\"http://stackoverflow.com/questions/5965378/background-image-of-a-css-loaded-as-an-embedded-resource\">this,和,但没有足够具体到CSS背景图像,我可以有信心它将工作:与该交易的多数文章都假定你是不是加载脚本或CSS文件。

Is this possible? I've seen some markup in places that suggests it might be, notably this, this, and this, but nothing sufficiently specific to CSS background images that I could be confident it would work: most articles that deal with this assume you are loading either script or CSS files.

推荐答案

我找到了答案!答案是:是的,你可以做到这一点!这里是如何:并的这个

I found the answer! The answer is: YES, you can do it! And here's how: this and this.

这篇关于CSS设置背景图像在图像是.NET程序集资源或WebResource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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