Monday, May 17, 2010

Remove browser padding or the extra space around web page contents using CSS

In Internet Explorer, an extra space is placed around the web page .

To remove them , use this following code :

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>:: My Website ::</title>
<style type="text/css">
*
{
margin:0 ;
}

body
{
background-color:grey;
}
#con
{
margin:auto;
width:800px;
height:600px;
background-color:white;
text-align:center
}
</style>
</head>

<body>
<div id="con">
<h1>Welcome</h1>
This works the body is showing at center of the window
</div>
</body>
</html>

Snapshot of this code :



Note: Padding is the blank space between the inside edge of the browser window and the actual web page contents.


No comments:

Post a Comment

Train Schedule Info

Subscribe

Quote

"There are two blessings which many people lose: (They are) Health and free time for doing good."
[Ref: Sahih al-Bukhari - Hadith number:6412]