Link to home
Start Free TrialLog in
Avatar of Phil5780
Phil5780

asked on

ASP.NET CSS Postback Stripped???

I have an ASP.NET master page  that contains a header and footer enclosed in a table.  The master page contains a link to my CSS file which my header login link uses for a roll-over button.  I've setup CSS as follows:

a.ButtonTest:link
{
    background-image: url(../images/SimpleButtonUp.gif);
    background-color: transparent;
    color: White;
    cursor: pointer;
    width: 80px;
    height: 23px;
}

a.ButtonTest:hover
{
    background-image: url(../images/SimpleButtonDown.gif);
}

This works perfectly upon loading my home page but navigating anywhere else results in the background image being stripped from the CSS.  The relative path to the background image is EXACTLY the same as any of the pages I navigate to.

What's going here?  How do I make my master page CSS survive posting?
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phil5780
Phil5780

ASKER

Ok, after further trial and error I find that my CSS in the sheet (just the markup shown above) gets ignored after postback. The page I begin with and the page I navigate to are in the same relative location.  The postback is breaking my CSS, how do I fix this?
try to specify the absolute path


background-image: url(/ParentFolder/images/SimpleButtonUp.gif);
hi,

There maybe a problem in where you put your link to the CSS and might be causing you the break. You can check if you have done the same as this:

<head runat="server">

  <style type="text/css" media="all">
    @import "styles/styles.css";
  </style>
  
</head> 

Open in new window

Can you post your css file markup (How are you adding it to master page?)
e.g in
 <head runat="server">

    <link href="Styles/myCssSample.css" rel="stylesheet" type="text/css" />  
</head>  
You were right, my relative path was wrong.  No everything work just fine.