CssClass - Info and Example(s) wanted.

joe_pool_is

Contributor
Joined
Jan 18, 2004
Messages
507
Location
Longview, TX [USA]
In the ASP.NET environment using VS.NET, there is a WebControl Appearance Property called CssClass that I have always been curious about how to use. (Similarly, the Properties for things like the <BODY> tag include Style elements.)

I searched all of this forum, but only found one instance of someone asking about CssClass. I went to MSDN's site, and I was able to find what CssClasses are for and how to create them, but not how to use them in my ASP.NET classes using VS.NET.

Are there any good links out there that I could look into for tutorials or examples? Could someone tell me in a nutshell how to use this property and how to create the CssClass? I assume it is a separate file for the project, but I hate to ***-u-me.

Any pointers from those "in the know" would be greatly appreciated.
 
When you specifiy a CssClass on a control, then the class attribute of a <span>(for labels) or the form element itself, will be set. So if youw anted a textbox to have a particular style, yu would set its CssClass. then either in your inline css you specify that class or you could put it in a external file in which you reference.
Code:
<html>
<head>
<style>
.big-letters { size:20px; }
</style>
</head>

<body>
<asp:Label id="Label1" runat="server" CssClass="big-letters"></asp:Label>
</body>

</html>
 
external file(s)?

First, my apologies for over stepping the bounds in my colorful metaphors above. I simply wasn't paying attention.

How to create CSS scripts seems straightforward enough, but I have never used a separate file for holding my scripts. Would the separate file need to begin with <html><script> (( other code here )) </script></html> or simply start with the first line reading ".style"?

Web pages are a hobby of mine, but I've never included a separate text file for either JavaScript or CSS scripts.

Thanks for the links, too! I will certainly be exploring them.
 
Back
Top