tags:

views:

31

answers:

2

i have a unordered list(HTML) whose style i am changing conditionally in the code behind

<ul class="steps">
  <li class="" id="step1" runat="server">Step 1</li>
  <li class="step2" id="step2" runat="server">Step 2</li>
  <li class="step3" id="step3" runat="server">Step 3</li>
  <li class="step4" id="step4" runat="server">Step 4</li>
</ul>

in the code behind iam doing something

step1.Attributes["class"] = "step1";
step2.Attributes["class"] = "step2New";

something like this

If iam using internal styles then its working fine but when iam taking the same style sheet to external file then it is not working

Is it because i am assigning attributes using id i don't know please help me

the css file is some what like this

ul.steps li 
{
display:block;   
position:relative;
float: left;
color: white;
background: url('Images/steps.png') left -518px no-repeat;
min-height:60px;
height: 4em; 
min-width:202px;
width:20%;
line-height: 4em;
font-weight: bold;
font-size: 130%;
margin-bottom:1em;
text-align:center;
overflow:hidden;
margin-left:-20px;
}
ul.steps li.step1
{
    background-position: left -418px;
}
ul.steps li.step2,ul.steps li.step3New, ul.steps li.step4New,ul.steps li.step4New2
{
    background-position: left -118px;
}
ul.steps li.step2New
{
    background-position: left -218px;
}
ul.steps li.step2New2
{
    background-position: left -318px;
}
ul.steps li.step3, ul.steps li.step4
{
    background-position: left -18px;
}
/*ul.steps li.step3New
{
    background-position: left -118px;
}*/
ul.steps li.step3New2
{
    background-position: left -218px;
}
ul.steps li.step3New3
{
    background-position: left -318px;
}
/*ul.steps li.step4New
{
    background-position: left -118px;
}
ul.steps li.step4New2
{
    background-position: left -118px;
}*/
ul.steps li.step4New3
{
    background-position: left -218px;
}
li
{
list-style-type:none;
display:inline;
}
A: 

Are you referencing the external CSS file correctly? You need to place a link element in the head section of the html, with the href attribute pointing to the CSS file:

<link rel="stylesheet" type="text/css" href="external.css" />
Oded
yes iam doing that
Mac
@Mac - then please post both the internal and external stylesheets, so we can see what is going on.
Oded
yes i have added the css file i am using the same as external as well internal
Mac
@Mac - since things are not working, I can only assume that you are not importing the external stylesheet correctly into your page.
Oded
may be Oded let me look into it once again and thanks a lot for your guidance
Mac
i got it its because of the background URL i am using background: url('Images/steps.png') left -518px no-repeat;but i corrected it tobackground: url('../Images/steps.png') left -518px no-repeat;
Mac
A: 

Use

 background: url('../Images/steps.png') left -518px no-repeat;
Mac