Cascading Style Sheets define the page-rendering mechanism by setting pagemarkup definitions that can be applied to an HTML document. This can be done internally in each HTML document of the web site or can reside on the server in a separate .css file and be referenced in each of the HTML documents. Having this as a separate file makes sense, as this can be a centralized point of change for any styles in the web site. Numerous styles can be applied to a file, and what the developer or end user needs to change is the style name of their HTML elements, which is associated in the .css file.
CSS is basically used for styling and positioning an HTML element.This enables the web site manager to extend formatting features to be presented to the viewer. One of the major drawbacks of CSS is that it is not compatible with all browsers. If JavaScript is disabled in your web browser or is incompatible across the browsers (even with different versions of the same vendor), the content formatting or styles
css file:
.font
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10px;
color:#003366;
}
.heading
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:14px;
font-weight:bold;
color:#003366;
}
.subheading
{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
font-weight:bold;
color:#E15438;
}
In the preceding content, you find several attributes bundled inside the braces with a name. This is represented as a class in CSS jargon. So, font, heading, and subheading are all classes in the sense that they act as formatters when applied to an HTML element in a page. Let’s say our web site has standard heading and subheadings for several sections spread across all the pages. Instead of setting all these attributes to the HTML tag wherever a heading is present, we can directly associate this class to that tag:
<div id=”divHeading” class=”heading”> Cascading Style Sheets ! </div>
CSS in ASP.Net
Hot on Web: