ASP.Net and CSS

Julianx

New Member
Can I still use CSS to format a server-side control, say a asp:textbox? If yes, how? Thanks.I mean, can I still have a css file and link to it externally? I know that I can set some css styles in the asp:textbox control itself, but I want to just have a file that every asp:textbox would be referencing.Include the CSS file in your document with the control (either by spelling it out explicitly in the <STYLE> tag or by using the @import directive in CSS). This CSS file should have a class (call it .MyClass) that has all of the style properties you wish to specify. Then, in your control, you could do:<BR><BR><asp:controlname runat="server" CssClass="MyClass" ... /><BR><BR>Happy Programming!i don't know of a way to overwrite the settings for ALL asp:textbox references like u would the 'a' tag in css. but if you want to set ur asp:textbox to a centralized css class, all u have to do is set the CssClass property of the textbox. for example...<BR><BR><asp:textbox id="TextboxName" CssClass="TextBox" runat="server" /><BR><BR>all u have to do is create a new css class in ur central .css file named .TextBox and define properties and ur good to go.
 
Back
Top