ASP.NET: Basic CSS

Cascading Style Sheets (CSS) and HTML go hand-in-hand like two people of any combination of genders who love each other. Generally speaking, CSS defines the style rules for webpages, from three levels of application:

External CSS refers to style rules defined in separate files from the HTML content itself, in order for multiple webpages to all include those same styles. As a web developer, this is where you define the overarching themes to be used for your website, such as banners, background colors, button appearances, and more.

Global CSS refers to style rules defined for the entirety of a single HTML page, that will override styles inherited from external CSS. For your own sanity and for the efficiency of pushing out style updates, you don't want to abuse this, but it can be useful for one-off styles needed for only a small number of webpages.

Local CSS refers to style rules defined for only one specific tag within an HTML page. This will override styles inherited from external CSS, and global CSS. Once again, you want to use this sparingly.

Generally speaking, we're defining CSS rules to apply to either every tag of a single type, or to a class of tags that we define as the developer. For example, this

p    { color: blue; }

would define the text within all p tags (within this scope) to use a blue font color. This

.blueText    { color: blue; }

would define the text within any tag that defines "blueText" as a class attribute, to then use a blue font color (if possible). For example, the Courier New font I use above is achieved within a span container, coded as:

<span class="code">PaintEventArgs</span>

It doesn't take much effort to achieve basic styles like this, but you can expand CSS usage to define truly beautiful web styles, as demonstrated from one of my favorite websites: CSS Zen Garden, where the content of each page is the same, but the wildly inventive use of CSS presents it in unique ways.