Friday, October 05, 2007

CSS not working on LinkButton

This was my issue , i had defined link button in asp.net like this :


_linkNewIncident = new System.Web.UI.WebControls.LinkButton();
_linkNewIncident.Text = "Creat New Incident";
_linkNewIncident.Click += new EventHandler(linkNewIncident_Click);
_linkNewIncident.CssClass = "HelpDeskLink";

and corresponding CSS as :
.HelpDeskLink { color:white ; font-weight :bolder ; font-size :x-small ; }

.HelpDeskLink a { color:white ; font-weight :bolder ; font-size :x-small ; }


when i ran the application , my links were still blue and was not reflecting any CSS behaviour which is supposed to be white as per my CSS :-(


After some search i got the solution .

Solution : Define "CSS Pseudo-classes"

I modified my CSS style class to the following and it worked ..


a.HelpDeskLink:link
{
color:white ;
font-weight :bolder ;
font-size :x-small ;
}

No comments:

Gray Failures: What is it and how to detect one?

If you are reading this article , i guess you are curious to know about gray failures and different methods to detect gray failures.  Hopefu...