Best way of applying styles to a hyperlink control RRS feed

  • Question

  • User1953081067 posted


    Can anyone suggest the best way of applying CSS styles to a hyperlink control; specficlly:

    a:link, a:hover, a:active, etc.

    If I use a CSS sheet and then 'cssClass='myStyles', the CSS doesn't work (other than simply changing the colour), but if I wrap the hyperlink control in a DIV and assign the CSS class to the DIV, the styles for the above work fine.

    But wrapping the hyperlink control on a DIV this way just doesn't seem right somehow? Is there a better way?

    Many thanks as always

    Monday, December 27, 2010 4:39 PM


  • User1953081067 posted

    Solved it!


    <asp:HyperLink ID="HyperLink_FAQ" runat="server" CssClass="MainHeaderLink" NavigateUrl="~/faq/Default.aspx" title="Review our frequently asked questions to answer some of the more common queries">FAQ</asp:HyperLink>


    a.MainHeaderLink, a.MainHeaderLink:link, a.MainHeaderLink:active, a.MainHeaderLink:visited
        font-size: 1.2em;
        color: #0c3461;
        font-weight: bold;
    	text-decoration: none;
    	outline: none;
    	color: #e4810d; /* Orange */

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 27, 2010 5:05 PM