Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
How to use css in asp.net in Simple solutions of Asp.net/Ado.net/C#.net(Dotnet)
6832 Views
Introduction 
Can write css for asp.net in 3 ways.
  1. Seperate style sheet (external style),
  2. Internal style,
  3. Inline style.
1. External style sheet 
In this method,write the css in seperate style sheet and link the style sheet in master page or required page.
Look 
Syntax to link the style sheet in page
Inside the head tag write this.
<head>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
</head>
2. Internal style 
In this method, write style directly in page inside the head tag.
Example
	<head>
	<style type="text/css">
	       .style1
	       {
	           width: 436px;
	           text-align: center;
	           height: 45px;
	       }
	       .style2
	       {
	           color: #0066CC;
	           text-align: center;
	       }
	  </style>
	</head>
3. Inline style 
In this method, write the style directly in tags.
Example
	<asp:TextBox ID="UserName"  runat="server" value="Username" MaxLength="20" style="ForeColor:#707070;"></asp:TextBox>
	/*In this example, the fore color given directly in text box tag.*/
Best Lessons of "Asp.net/Ado.net/C#.net(Dotnet)"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details