I’ve noticed when trying to apply the ‘style’ attribute to an asp:TextBox control, for example or when attempting to use a css class to apply a style, it doesn’t take. I have to specifically set the attribute. For instance:
<asp:TextBox runat="server" ID="DescriptionTextBox" BackColor="#F7FCFF" /> // Works
<asp:TextBox runat="server" ID="DescriptionTextBox" CssClass="textbox" /> // Doesn't work
<style type="text/css">
.textbox
{
background-color: #F7FCFF;
}
</style>
I know this is a simple question, but can someone kindly shed some light on it for me?
Thank you
Don’t get too confused over what an asp control actually is. In fact all it does is generate HTML, which is what the CSS is then applied to.
Your second example with
CssClassshould work, but instead of debugging by looking at your aspx you really need to check out the HTML (using your browsers version of the developer tools such as Firebug will show you what styles are being applied).