Friday, April 13, 2012

How to define a CSS in general HTML?


Am not very good in explaining things. So, Instead of Explaining CSS(Cascading Style Sheet), let me straight away start with HOW TOs'?

The following is a basic style
<style type="text/css">
.textborder{border:0.5px solid black;}
</style>
The above code will be placed inside in two ways.Head section like the below:-

Method 1:- Placing directly inside <head/> section.
<html>
<head>
 <style type="text/css">
.textborder{border:0.5px solid black;}
</style>
</head>
<body>
<div class='textborder'>INFOTRON Krishna - http://www.krishnainfotron.blogspot.com</div>
</body>
</html>

Method 2:-
Step 1:- Place the code in a single notepad and save it as anything.css. The code should not be enclosed with (i.e) In the anything.css the notepad should be just like below:-
.textborder{border:0.5px solid black;}
and the HTML section should contain the following code.
Step 2:- Embedding the style into a HTML. Place the following code inside <head/> section.
<link rel="stylesheet" type="text/css" href="anything.css" />
There fore the HTML looks like this:-
<html>
<head>
<link rel="stylesheet" type="text/css" href="anything.css" />
</head>
<body>
<div class='textborder'>INFOTRON Krishna - http://www.krishnainfotron.blogspot.com</div>
</body>
</html>

The above code will yield the result as below :-
INFOTRON Krishna - http://www.krishnainfotron.blogspot.com

No comments :

Post a Comment