can't ref img in theme stylesheet

K

kpg

Hi all,


I am setting an image on a page and the image is defined in the
stylesheet
unsed a theme folder. Problem is no matter how I define the image url
it does not display.

The site has the following file structure:

root
default.aspx
-App_Themes
--defaultTheme
----SkinFile.skin
----StyleSheet.css
-Images
----bg.jpg

In the style sheet:

img#bg
{
src:url(Images/bg.jpg);
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}


In default.aspx:

<img id="bg" />


I have tried ..\Images\bg.jpg and ../../Images/bg.jpg also, thinking
I needed to go up one ot two folders first.

I know I've done this in the past using asp controls and there the ~
app root function works fine.

Becuase I'm using the images as a streched background I'm using a
standard HTML img (I suppose the asp:Image may also work, but I
have not tried that yet).

I am sure there is a way to reference images form a stylesheet under
a theme folder, but I can;t seem to make this work.

Any ideas?

Thanks,
kpg
 
K

kpg

I've answered my own question.

It seems img src cannot be set in CSS. That seems odd to me,
but that seems to be the case. If anyone knows different,
please do tell.

To fmake it work I've changes the HTML img to an asp:Image:

<asp:Image ID="bg" skinID="bgImage" runat="server" />

In the skin file I added:

<asp:Image skinID="bgImage" runat="server" ImageUrl="~/Images/bg.jpg"/>

The stylesheet is the same except I removed the src from img#bg.

Works fine.
kpg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top