---
title: "Themes in Asp.net"  
description: "A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across page"  
author: "Chris Anderson"  
published: 2011-08-09  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/224/themes-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 2 minutes  

---

# Themes in Asp.net

A theme is a [collection](https://www.mindstick.com/articles/1718/collections-in-java) of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in [Web Application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about).\

Themes are made up of a set of elements: skins, [cascading](https://www.mindstick.com/blog/94/css-cascading-stylesheet) [style sheet](https://www.mindstick.com/interview/1606/what-are-style-sheets) (css), images, and other resources.\
Themes are defined in special directories in [your Website](https://www.mindstick.com/articles/12990/ssl-certificate-why-you-need-one-for-your-website) on your [Web server](https://www.mindstick.com/articles/23199/digital-personal-server-the-premium-web-server). Each theme is a different subfolder of the \App_Themes folder.

```
MyWebSite à Website name  App_Themes àFolder that contains Themes    Theme1 à Theme Folder      SkinFile.skin à SkinFile name      StyleSheet.css à StyleSheet File Name
```

##### How to create Theme?

##### Skins

A skin file has the [file name](https://www.mindstick.com/interview/34109/how-do-you-generate-a-unique-file-name-to-avoid-overwriting-an-existing-one) with [extension](https://www.mindstick.com/articles/22/extension-method) .skin and contains property settings for individual control such as Button, TextBox, Calendar or Label controls. You create skin files in the theme folder.

```
<asp:Button runat="server" BackColor="Red" ForeColor="White" />
```

\

##### Cascading Style Sheets

\

A theme can also include a cascading style sheet (.css file). When you put a .css file in the theme folder, the style sheet is applied automatically as a part of the theme. You define a style sheet using a file name extension .css in the theme folder.

```
                body {   background-color: #2C2C2C;  }
```

\

How to Apply Theme?

You can apply themes to a page or a [Web site](https://www.mindstick.com/articles/12285/the-finest-web-site-design-trends-you-may-expect-in-2017).

To apply a theme to a Web site

Add code in [web.config](https://www.mindstick.com/forum/183/web-config-file) file

###

```
<system.web>        <pages theme="Theme1"></pages> //Theme1 is the name of the Theme   </system.web> 
```

##### \

##### To apply a theme to an individual page

\

##### Add code in page directive

```
  <%@ Page Theme="Theme1" %> //Theme1 is the name of the Theme 
```

##### To apply a theme to an individual page dynamically

**\**

```
  protected void Page_PreInit(object sender, EventArgs e)           {              Page.Theme = "Theme1"; // Theme1 is the name of the theme           }
```

---

Original Source: https://www.mindstick.com/blog/224/themes-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
