Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use CSS in ASP.NET application

Tags:

html

css

asp.net

I want to know to use CSS in ASP.NET.

If I have set of CSS files and I link my master page to them, how to utilize them to make my application look good. I'm not talking about CSS itself but about how to use its elements in the source of any ASP.NET page.

I'm looking for suggestions, resources, sites, or opinions.

like image 290
Anyname Donotcare Avatar asked Nov 28 '22 19:11

Anyname Donotcare


2 Answers

in controls there is a property CssClass

<asp:Button ID="Button1" CssClass="Red" runat="server" Text="Button" OnClientClick='ani();'/>
like image 162
anishMarokey Avatar answered Dec 10 '22 04:12

anishMarokey


In addition to @anishmarokey's answer don't forget that all all ASP.NET markup will render as HTML on the browser, so you can do anything that you can do to HTML. This even includes adding attributes such as style to all elements (even though intellisense will not prompt it). This will render correctly as a HTML style attribute on the client.

In addition CssClass can only be used on ASP elements, all others will require style

like image 22
m.edmondson Avatar answered Dec 10 '22 04:12

m.edmondson