Setting the color of a link button you use the forecolor attribute on
, but how do I set this if I wish to use a CSS?Code:<asp:linkbutton id="btnLink7" text="test" forecolor="white" runat="server"/>
Printable View
Setting the color of a link button you use the forecolor attribute on
, but how do I set this if I wish to use a CSS?Code:<asp:linkbutton id="btnLink7" text="test" forecolor="white" runat="server"/>
Couple of different ways, use a css class or use the style attribute:
Code:<html>
<head>
<style type="text/css">
a.MyLinkButton
{
color:#000088;
text-decoration:none;
}
a.MyLinkButton:hover
{
color:#00aacc;
text-decoration:underline;
}
</style>
</head>
<body>
<form runat="server">
<asp:LinkButton
id="MyLinkButton"
runat="server"
text="My Link Button"
CssClass="MyLinkButton"/><br />
<asp:LinkButton
id="MyLinkButton2"
runat="server"
text="My Other Link Button"
style="color:#000088;font-weight:bold;text-decoration:none;"/>
</form>
</body>
</html>