Hyperlink Image in CSS or skin for theme

I've created several themes using css and skins.

In my master page, I want to have the logo dependent upon the current theme being used. So within each theme directory, I have a logo named: Logo.gif

Currently, I just have this within the master page.

                        <a href="<%= ResolveClientUrl("~/default.asp")%>">
                    <img src='<%= ResolveClientUrl("logo.gif")%>' width='228'
                                height='77' style='border: none'></a></td>

How do I change it to setup the logo.gif within the skin or style sheet, and then display it (hyperlinked as above) within my master page?

thanks!
LVL 2
Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Göran AnderssonConnect With a Mentor Commented:
If you specify the image as a background in the css, the browser will get the image relative to the css file instead of relative to the page.

If you put the logo image in the theme filder where the css file is, this will use it:
css:
 
.Logo { width: 228px; height: 77px; background: url(logo.gif); }
 
html:
 
<a href="<%= ResolveClientUrl("~/default.asp")%>" class="Logo"></a>

Open in new window

0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
hmmm. I tried this:

<asp:HyperLink ID="HyperLink1" runat="server" CssClass="Logo" NavigateUrl="~/Default.aspx">[HyperLink1]</asp:HyperLink>

and this:

<a href="<%= ResolveClientUrl("~/default.asp")%>" class="Logo"></a>

This does display the logo, but no hyperlink:

                    <div class="Logo"></div>

What am I doing wrong?

thanks!



0
 
Göran AnderssonConnect With a Mentor Commented:
Ah, I missed that the link has to be a block element in order for one to specify the size.
.Logo { display: block; width: 228px; height: 77px; background: url(logo.gif); }

Open in new window

0
 
Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
yay, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.