Hi.. You can create css file in asp.net and even you can use here a better concept that is themes.
A theme is contain two types of file 1. css and 2. skin . You can choose css by using the cssClass property and Skin for SkidID
To add css file is easy. Just Add new item->Css file
add some classes to the css file. You can even write the css class without creating new file, and inside the
<style type="text/css">
.div1
{
z-index:1;
position:absolute;
}
</style>
► applying css file is also easy just by the
for html control
<div class="div1">
for server control
<asp:Image ID="Image3" CssClass="imgBig" runat="server" ImageUrl="~/1.bmp" />
► Using SkinFile
You can implement thems by adding new .skin file in your website:
1. Add one skin file in your website:
2. It will ask you to add in App_Themes folder say yes
3. Add the code in your skin file
Just for beginning add the code :
<asp:button runat="server" BackColor="lightblue" ForeColor="black" />
And save it. Now in you webpage in Page Directive add the Theme property = skinfile ex:
<%@ Page Theme="SkinFile" Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs"Inherits="Default5" %>
Add one button in your webpage. And Run the page. You will get the effect of button as you have provided in the theme file
► Apply skin from code behind
protected void page_PreInit(object sender, EventArgs e)
{
Page.Theme = "SkinFile";
}
Also with skin file you can add a css similar to it which you can access from everypage