Saturday, 25 February 2012

HOW To Implement CSS in your HTML Page: Inline CSS

After basic HTML page has been created now it's a time to implement CSS. First we are discussing how we can apply css in inline page with <style></style> tag.

Some Basic CSS:

font-family - It is defined your font family which you need to use

font-size - It is used for your text size

color: It is used for your text color

background-color: It is used for background color

background-image: It is used for background image

background: It you want to use background image/color then you can use this tag in common

border: For giving border. You can use border-top, border-right, border-left, border-bottom for different border.

font-weight: to define normal or bold text

font-style: define normal or italic text

It is enough for beginner. Let's move ahead with implementation of CSS in HTML Page:

Note: You can implement <style></style> tag in between <head></head> tag.

<style>

body{ /*for implement in whole page */

background-color: #999999;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 12px;

margin:0;

padding:0;

}

.style1{

font-weight: bold;

}

</style>

So, now structure will be be:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>My Website</title>
<head> 
<style>
 body{ /* for implement in whole page */
   background-color: #999999;
   font-family: Verdana, Arial, Helvetica, sans-serif;
   font-size: 12px;
    margin:0;
    padding:0;
 }
 .style1{
   font-weight: bold;
 }
</style>
</head> 

<body>
<table cellpadding="0" cellspacing="0" border="0" width="400" align="center">
  <tr>
    <td><img src="mywebsite/images/logo.jpg" alt="my website title" /></td>
  </tr>
  <tr>
    <td class="style1">My Website Content</td>
  </tr>
</table>
</body>
</html>

No comments:

Post a Comment