in Education by (1.9m points)
What is the best way to add a cascading stylesheet (CSS) to a web application project in visual studio 2010?

For example if I have the followingL

<asp:Label ID ="lName_lbl" runat="server" text="Last Name:  "></asp:Label>

<asp:TextBox ID="lName" runat="server"></asp:TextBox>

<br />

How do i style all asp labels to have the same properties?

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.9m points)
As the other answers have correctly mentioned, you can use the CssClass attribute for controls that support it.

You can also style the elements using CSS Selectors

ASP.Net makes it easy to add stylesheets to your application via the App_Themes folder. CSS specified in here corresponding to the theme you set in the page or web.config will be automatically loaded. No need to link the css manually.


If you don't already have an App_Themes folder, right click your project, and choose Add->Add ASP.Net Folder->Theme and this will create it for you. To make sure the Theme is used set it in the web.config (via the <pages theme="" attribute) or at the page level. See the App_Themes page for more information.

Related questions

0 votes
asked Mar 1 in Education by JackTerrance (1.9m points)
0 votes
asked Oct 23, 2021 in Education by JackTerrance (1.9m points)