---
title: "CSS Class"  
description: "In this blog, I’m trying to explain the css class property and how to implement in your web pages.   CSS Stands for \"Cascading Style Sheet.\" Cascading"  
author: "Sumit Kesarwani"  
published: 2013-05-29  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/516/css-class  
category: "css-css3"  
tags: ["css-css3"]  
reading_time: 3 minutes  

---

# CSS Class

In this blog, I’m trying to explain the css class property and how to implement in your [web pages](https://www.mindstick.com/blog/367/transferring-data-between-asp-dot-net-web-pages).\

CSS Stands for "[Cascading](https://www.mindstick.com/blog/94/css-cascading-stylesheet) [Style Sheet](https://www.mindstick.com/interview/1606/what-are-style-sheets)." Cascading [style sheets](https://www.mindstick.com/forum/506/why-do-we-use-style-sheets) are used to format the layout of Web pages. They can be used to define text styles, table sizes, and other aspects of Web pages that previously could only be defined in a page's HTML.

CSS helps [Web developers](https://www.mindstick.com/articles/341147/how-web-developers-are-strengthening-online-safety-in-2025) create a uniform look across several pages of a [Web site](https://www.mindstick.com/articles/12285/the-finest-web-site-design-trends-you-may-expect-in-2017). Instead of defining the style of each table and each block of text within a page's HTML, commonly used styles need to be defined only once in a CSS document. Once the style is defined in cascading style sheet, it can be used by any page that references the CSS file. Plus, CSS makes it easy to change styles across several pages at once. For example, a Web [developer](https://www.mindstick.com/articles/157260/variation-between-web-designer-and-web-developer) may want to increase the default text size from 10pt to 12pt for fifty pages of a Web site. If the pages all reference the same style sheet, the text size only [needs to be changed](https://answers.mindstick.com/qa/99340/what-are-the-signs-that-the-brake-fluid-needs-to-be-changed-in-my-car) on the style sheet and all the pages will show the larger text.

While CSS is great for creating text styles, it is helpful for formatting other aspects of [Web page](https://www.mindstick.com/forum/718/sql-server-report-alignment-to-center-of-web-page) layout as well. For example, CSS can be used to define the cell padding of table cells, the style, thickness, and color of a table's border, and the padding around images or other objects. CSS gives Web developers more exact control over how Web pages will look than HTML does. This is why most Web pages today incorporate cascading style sheets.

##### Example

![CSS Class](https://www.mindstick.com/blogs/493683af-8303-4a95-b027-31cb06df1a7b/images/fa45f7f4-9891-4a9d-970d-137261e470b3.jpg)

```
<form id="form1" runat="server">    <div>        <table>            <tr>                <td>                    <asp:Label ID="lblName" runat="server" Text="Enter Name :"></asp:Label>                </td>                <td>                    <asp:TextBox ID="txt1" runat="server"></asp:TextBox>                </td>            </tr>            <tr>                <td>                </td>                <td>                    <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />                </td>            </tr>            <tr>                <td>                   <asp:Label ID="lbl2" runat="server"></asp:Label>                 </td>            </tr>        </table>    </div>    </form>
```

Type the following code in .aspx.cs file

```
using System;namespace CSSClassWebApplication{    public partial class Default : System.Web.UI.Page    {        protected void Page_Load(object sender, EventArgs e)        {        }        protected void Button1_Click(object sender, EventArgs e)        {            lbl2.Text = "Your Name Is : " + txt1.Text;            txt1.Text = "";        }    }}
```

##### StyleSheet1.css

```
body, input{    font: 12pt verdana;    font-weight: 700;    color: orange;}
```

In this example, I’ve used CSS Class property to format the font and color of the controls. I’ve created TestStyle css in the <script> tag and set the values of font, font-weight and color and used it in all controls.

---

Original Source: https://www.mindstick.com/blog/516/css-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
