can't ref img in theme stylesheet

  • Thread starter Thread starter kpg
  • Start date Start date
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
 
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
 
Back
Top