---
title: "CSS (Cascading StyleSheet)"  
description: "Cascading Style Sheet (CSS) is a language which defined some formatting rule for html control. CSS are a collection of formatting rules that control t"  
author: "Amit Singh"  
published: 2011-01-11  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/94/css-cascading-stylesheet  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# CSS (Cascading StyleSheet)

[Cascading](https://www.mindstick.com/interview/1997/what-is-a-cascading-update) [Style Sheet](https://www.mindstick.com/interview/1606/what-are-style-sheets) (CSS) is a language which defined some formatting rule for html control. CSS are a [collection](https://www.mindstick.com/articles/1718/collections-in-java) of formatting rules that control the appearance of content in a [web page](https://www.mindstick.com/forum/718/sql-server-report-alignment-to-center-of-web-page). CSS apply in our [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) by following types:

##### External Style sheet

We use files and defined the CSS property and values in file and save it by .css extension. We use the css file in our project by link tag in head section

For example

```
<head runat="server">             <link href="StyleSheet.css" rel="stylesheet" type="text/css"/> </head>
```

##### Internal Style Sheet

Internal style sheet defined in head section by using the style tag

##### For example

```
<style type="text/css">           body{color:Gray; font-size:small; }</style>
```

##### Inline Style Sheet

##### Inline style sheet are used as

##### For example:

```
<asp:TextBox ID="TextBox1" runat="server" style="border:solid 1 red;"></asp:TextBox> 
```

\

**Note**: In inline style we use the style [properties](https://www.mindstick.com/articles/23331/nootropics-7-different-types-and-their-unique-properties) of the control set the value. In internal and [external](https://www.mindstick.com/articles/12810/how-to-connect-tablet-to-external-monitor-or-flat-screen-tv-using-computer-adapters) style sheet we apply the CSS on control by using the class properties for html control like <div class=”div1”>. And for the asp control we use the cssclass property for that control.

##### CSS ID and Class

CSS allows you to specify your own [selectors](https://www.mindstick.com/interview/22831/what-is-the-use-of-selectors-in-objective-c) called "id" and "class".

The Id selector is defined for a single, [unique element](https://answers.mindstick.com/qa/115057/what-unique-element-blending-song-dance-is-central-to-mainstream-indian-movies) basically for control or tag id. It is defined with # sign

\

##### For example

<div id=”div1”>Heloworld</div>

#div1{ color:Red;}

The class selector is used to specify a style for a [group of elements](https://www.mindstick.com/forum/159728/how-to-get-a-selected-value-from-the-group-of-elements-with-the-same-name) and it is defined with dot symbol.

\

##### For example

.p1{text-align:left;color:Red;}

And apply it as <p class=”p1”>This is the class selector</p>

---

Original Source: https://www.mindstick.com/blog/94/css-cascading-stylesheet

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
