开发者

Setting CSS background-image where the image is a resource or WebResource in a .NET assembly

开发者 https://www.devze.com 2023-04-13 03:40 出处:网络
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.

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.

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.

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 开发者_如何学Gothat 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消