作为嵌入资源加载的 css 的背景图像 [英] background image of a css loaded as an embedded resource

查看:31
本文介绍了作为嵌入资源加载的 css 的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在类库中创建了一个控件,默认情况下应该使用一些 CSS 对其进行样式设置.我创建了一个 CSS 文件,将其添加到库中,并将其作为资源嵌入,以便它可以用于默认样式.

I have a control created in a Class Library and it should be styled by default with some CSS. I've created a CSS file, added it to the library and I am embedding it as a resource, so that it can be used for the default styling.

CSS 文件包含一些设置 background-image 属性的类.用于此的图像也作为嵌入资源添加到我的库中.正如预期的那样,CSS 将正确运行,但它不会显示图像,因为它们是相对于 css 文件添加的,因此对 ../images/my_image.png 的请求将导致 404,因为它实际上并不存在my_image.png,但下载为 .axd 资源.

The CSS file contains some classes that set the background-image property. The images used for this are added as embedded resources in my library as well. As expected, the CSS will run correctly, but it will not display the images since they are added relative to the css file, so a request for ../images/my_image.png will result in a 404 since it actually does not exist as my_image.png, but downloaded as a .axd resource.

关于如何克服这个问题有什么想法吗?

Any ideas on how to overcome this?

非常感谢任何和所有帮助.

Any and all help is greatly appreciated.

卡利.

推荐答案

为什么不自己做这件事我记得读过一篇关于在嵌入式资源中获取 javascript 的文章.

Why not having done this myself I remember reading an article for getting the javascript in an embedded resource.

使用 WebResource.axd 通过 URL 访问嵌入式资源http://www.4guysfromrolla.com/articles/080906-1.aspx

Accessing Embedded Resources through a URL using WebResource.axd http://www.4guysfromrolla.com/articles/080906-1.aspx

这篇关于作为嵌入资源加载的 css 的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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