CSS problem with causing white space

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

CSS problem with causing white space

Post by Luke »

I can't figure out why this site is going all out of whack. As far as I can tell it should work fine, but there is a bunch of extra white space.
http://lotsofshirts.com/guntshirts/index.php

HTML:

Code: Select all

<!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>
<title>Gun T-Shirts - Shirts for gun enthusiasts!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="style.css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('images/home_02.gif','images/shirts_02.gif','images/links_02.gif','images/about_us_02.gif','images/contact_us_02.gif')">
<center>
 <table class="center_main" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><img src="images/header_01.gif" width="129" height="154" alt="" /><img src="images/header_02.gif" width="129" height="154" alt="" /><img src="images/header_03.gif" width="129" height="154" alt="" /><img src="images/header_04.jpg" width="129" height="154" alt="" /><img src="images/header_05.jpg" width="129" height="154" alt="" /><img src="images/header_06.jpg" width="129" height="154" alt="" /></td>
  </tr>
  <tr>
    <td height="19" colspan="2" class="nav_bar" align="left"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/home_02.gif',1)"><img src="images/home_01.gif" name="home" width="88" height="27" border="0" id="home" alt="Home" class="ten_pad_sides" /></a><a href="shirts.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('shirts','','images/shirts_02.gif',1)"><img src="images/shirts_01.gif" alt="Shirts" name="shirts" width="88" height="27" border="0" id="shirts" class="ten_pad_sides" /></a><a href="links.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('links','','images/links_02.gif',1)"><img src="images/links_01.gif" alt="Links" name="links" width="88" height="27" border="0" id="links" class="ten_pad_sides" /></a><a href="about_us.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about_us','','images/about_us_02.gif',1)"><img src="images/about_us_01.gif" alt="About Us" name="about_us" width="106" height="27" border="0" id="about_us" class="ten_pad_sides" /></a><a href="contact_us.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact_us','','images/contact_us_02.gif',1)"><img src="images/contact_us_01.gif" alt="Contact Us" name="contact_us" width="120" height="27" border="0" id="contact_us" class="ten_pad_sides" /></a></td>
  </tr>
  <tr>
    <td class="left" valign="top"><div class="left_content"><p class="img_desc"><img src="images/header_02.gif" width="85" height="120" alt="" border="1" class="float_left" /><b>Shirt Name</b><br /></p></div></td>
    <td class="main" valign="top"><div class="main_box">&nbsp;</div></td>
  </tr>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
  <tr>
    <td height="19" colspan="2" class="nav_bar" align="center"><a href="index.php">Home</a> | <a href="shirts.php">Shirts</a> | <a href="aboutus.php">About Us</a> | <a href="links.php">Links</a> | <a href="contactus.php">Contact Us</a></td>
   </tr>
 </table>
</center>
</body>
</html>
CSS:

Code: Select all

body {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	color: #000000;
	text-decoration: none;
	background-color: #FFFFFF;
	margin: 0px;
	padding: 0px;
}
.header {
	color: #FFFFFF;
	background-color: #000000;
}
.nav_bar{
	background-image: url(images/nav_bg.gif);
	background-repeat: repeat-x;
	height: 30px;
}
.ten_pad_sides{
	padding: 0 10px 0 10px;
}
.center_main{
	max-width: 776px;
	border-left: 1px solid black;
	border-right: 1px solid black;
	border-bottom: 1px solid black;
}
a:link{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #0000CC;
	text-decoration: none;
}
a:active{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #0000CC;
	text-decoration: none;
}
a:visited{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #0000CC;
	text-decoration: none;
}
a:hover{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	color: #0000CC;
	text-decoration: underline;
}
.left_content{
	width: 250px;
	padding: 10px;
	margin: 10px;
	border: 1px solid #AAAAAA;
	background-color: #EEEEEE;
	
}
.main_box{
	width: 525px;
	padding: 10px;
	margin: 10px;
	border: 1px solid #AAAAAA;
	background-color: #EEEEEE;
}
img.float_left{
	margin: 0 10px 0 0;
	padding: 0 0 0 0;
	float: left;
}
.img_desc{
	text-align: left;
	padding: 0px;
	margin: 0px;
	height: 125px;
}
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

My guess is it has something to do with this:

.center_main: max-width: 776px

.left_content: 250 + 2x10 + 2x10 + 2x1 = 292px
.main_box: 525 + 2x10 + 2x10 + 2x1 = 567px

Total 292+567=859px
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

That would be it... you're the man.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

The Web Developer tool bar is useful at highlighting such things, to see exactly what is where.
Post Reply