Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Web Development & Graphic Design Problem Solving for Graphic Design, PHP, ASP, Perl, MySQL, SQL, XML, HTML issues

Reply
 
Topic Tools
  #1  
Old January 31st, 2008, 03:20 AM
Coolin Coolin is offline
Member
 
Join Date: Jan 2008
Posts: 32
HTML Cell Spacing Too Big

Hi I am trying to remove spacing around HTML generated table cells & would like to remove the white space generated by the following code as shown here above the name SMITH:

Code:
<html>
<body>

<table style="width: 259px; height: 71px">
	<tbody>
		<tr>
			<td style="width: 247px; height: 25px">
                ROGER<table style="height: 1px; width: 248px;">
					<tbody>
						<tr  style="background-color: #e6e6e6">
							<td style="width: 128px">
							<p>
                                JOHN</p>
							</td>
						</tr>
						<tr>
						<tr>
						</tr>
					</tbody>
				</table>
                </td>
		</tr>
	</tbody>
</table>
    SMITH

</body>
</html>
I have tried dragging & re-sizing on a WYSIWYG Editor but this seems to limit the size reduction to at least one line. I am a bit new to HTML so would appreciate any suggestions...
Reply With Quote
  #2  
Old January 31st, 2008, 06:21 AM
Buzz Buzz is offline
Cyber Tech Help Moderator
 
Join Date: Sep 2000
O/S: MacOS
Location: Oregon, USA
Posts: 4,005
Table tags need to remove the default spacing.

Code:
<table cellspacing="0" cellpadding="0" border="0" style="padding: 0; margin:0;">
<tr>
<td>

</td>
</tr>
</table>
I added the css to remove padding and margins as well. Remember, CSS doesn't automatically remove standard HTML preformatting. Things lick cellspacing and cellpadding always exist so you must adjust those. CSS properties must end with a ; as well. And I don't see why you've got a nested table, it doesn't appear to be needed.
Reply With Quote
  #3  
Old January 31st, 2008, 03:42 PM
Coolin Coolin is offline
Member
 
Join Date: Jan 2008
Posts: 32
Thanks very much, I've tried removing the defaults with the local code as follows but this alone isn't allowing me to remove the space I'm using browser IE6 & the reason for nesting is I have very large program within this existing arrangement though I may next try to alter nested table arrangement to get round problem

Quote:
<!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" >
<body>

<table cellspacing="0" cellpadding="0" border="0" style="width: 259px; height: 71px; padding: 0; margin:0;">
<tbody>
<tr>
<td style="width: 247px; height: 25px">
ROGER<table cellspacing="0" cellpadding="0" border="0" style="height: 1px; width: 248px; padding:0; margin:0;">
<tbody>
<tr style="background-color: #e6e6e6">
<td style="width: 128px">
<p>
JOHN</p>
</td>
</tr>
<tr>
<tr>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
SMITH

</body>
</html>
Reply With Quote
  #4  
Old January 31st, 2008, 08:55 PM
rockboy's Avatar
rockboy rockboy is offline
Cyber Tech Help Moderator
 
Join Date: Aug 2002
O/S: Windows 7 64-bit
Location: California, USA
Posts: 3,087
I can't remember for certain but I think that tables use a default value of 3 for unspecified cellpadding and cellspacing. That's why it changes if you specify 0. It helps when troubleshooting tables if you temporarily specify border="1" so your table is visible.

Put SMITH inside the same main table as the other entries. That's the reason for the extra white space. (The other names are in the main table but SMITH isn't.) Also, in your last post you have an extra tr tag that doesn't have an end tag and a row that doesn't have enclosed td tags. Some browsers don't like that.
Code:
JOHN</p>
</td>
</tr>
<tr>
<tr>
</tr>
</tbody>
Reply With Quote
  #5  
Old January 31st, 2008, 10:12 PM
Buzz Buzz is offline
Cyber Tech Help Moderator
 
Join Date: Sep 2000
O/S: MacOS
Location: Oregon, USA
Posts: 4,005
You've also got some improperly formatted HTML. Table Rows need to contain table cells and they should all be closed.

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" >
<body>

<table cellspacing="0" cellpadding="0" border="0" style="width: 259px; height: 71px; padding: 0; margin:0;">
<tbody>
   <tr>
      <td style="height: 25px">ROGER</td>
      <td style="width: 128px">JOHN</td>
      <td>SMITH</td>
   </tr>
</tbody>
</table>

</body>
</html>
The above code should show 1 row with 3 cells Roger on the left, John in the middle, and Smith on the right. Another issue is you've got the main table set to a width of 259px but the inner cells are much larger than that. This can cause the layout to break. THe main table width is the maximum width for all content in the table.
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
Topic Topic Starter Forum Replies Last Post
Landing Page Spacing Errors It'sMe Comments & Suggestions 3 October 22nd, 2011 10:01 AM
Whyyy? Css spacing and centering Zodiac_Rkx Web Development & Graphic Design 6 April 23rd, 2011 05:23 PM
Removal of HTML/Dldr.Barf.A HTML Script Virus neilp02 Malware Removal 1 February 15th, 2011 06:21 AM
Modified registry values regarding icon size & spacing, need original values Gnodab Windows XP 4 April 7th, 2008 09:31 PM
MS Word Line Spacing Default thejollyhatter Applications 3 August 27th, 2002 11:19 PM


All times are GMT +1. The time now is 06:26 AM.