Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to get rid of the default left table margin 2

Status
Not open for further replies.

IanNav

Programmer
Feb 26, 2001
79
Hi,

I could really do with some help with my html tables (i am still new html - sorry).

I have a table within a table and i get a margin space on the left hand side where the inside table joins the outside table.

(I hope you're not confused!)

I have tried <TABLE ALIGN="CENTER"> please can someone tell me how to turn this default to 0 or off..

Many Thanks

Ian
 
Yeah, no problem. Although i think it wo'nt help.

I copied/pasted some eg code from a html tutorial site, and on the site it looked fine.

When i loaded it up, it had the margin there....

------------See below Code ---------------------------


<table border="0" cellspacing="0" cellpadding="0" width="90%">
<tr>
<td bgcolor="#3AC6EF"><img src="images/topleft_cor.gif" border="0"></td>
<td bgcolor="#FFFFFF"width="100%">&nbsp;</td>
<td><img src="images/topright_cor.gif" border="0"></td>
</tr>
<tr width="800" height="800">
<td bgcolor="#FFFFFF">&nbsp;</td>
<td bgcolor="#3AC6EF" align="center">
<!--------------- new table detail ---------------------!>
<table align="center" width="100%" border="1" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<br>
<a href=" src="images/roseann.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a><br><br>
</td>
<td>
<h2><img src="images/roseann_trans.gif" align="left" width="250" height="50" border="0"></h2><br><br>
<b>Skipper : </b>Mike Baker<br>
<b>Phone (Daytime) : </b>+44 (0) 1793 520827<br>
<b>Phone (Evenings) : </b>+44 (0) 1392 209414<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7752 879 170<br>
<b>Email : </b><a href="mailto:skipperbaker@blueyonder.co.uk">skipperbaker@blueyonder.co.uk</a><br>
</td>
</tr>
<td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
<tr>
<td align="center">
<a href=" src="images/shande.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a>
</td>
<td>
<h2><center><img src="images/shande_trans.gif" width="250" height="50" border="0"></center></h2><br>
<b>Skipper : </b>Ian Goff<br>
<b>Business Phone : </b>+44 (0) 1392 209230<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7720 004544<br>
<b>Email : </b><a href="mailto:shande@deepsea.co.uk">shande@deepsea.co.uk</a><br>
</td>
</tr>
<td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
<tr>
<td align="center">
<a href=" src="images/smuggler.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a>
</td>
<td>
<h2><center><img src="images/smuggler_trans.gif" width="250" height="50" border="0"></center></h2><br>
<b>Skipper : </b>Colin Dukes<br>
<b>Business Phone : </b>+44 (0) 1626 890852<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7974 437740<br>
<b>Email : </b><a href="mailto:dukes@eclipse.co.uk">dukes@eclipse.co.uk</a><br>
</td>
</tr>
<td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
<tr>
<td align="center">
<a href=" src="images/tamesis.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a>
</td>
<td>
<h2><center><img src="images/tamesis_trans.gif" width="250" height="50" border="0"></center></h2><br>
<b>Skipper : </b>Nigel Dyke<br>
<b>Business Phone : </b>+44 (0) 1769 580376<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7970 909614<br>
<b>Email : </b><a href="mailto:tamesis.tfc@virgin.net">tamesis.tfc@virgin.net</a><br>
</td>
</tr>
<tr>
<td align="center">
<a href=" src="images/wavec1.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a>
</td>
<td>
<h2><center><img src="images/wavec1_trans.gif" width="250" height="50" border="0"></center></h2><br>
<b>Skipper : </b>Ian May<br>
<b>Business Phone : </b>+44 (0) 1392 823710<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7979 908912<br>
<b>Email : </b><a href="mailto:ianmay@wavechieftain.freeserve.co.uk">ianmay@wavechieftain.freeserve.co.uk</a><br>
</td align="center">
</tr>
<td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>
<tr>
<td align="center">
<a href=" src="images/wavec2.jpg" width="250" height="200" border="0"></a><br>
<a href=" Web Site</a>
</td>
<td>
<h2><center><img src="images/wavec2_trans.gif" width="250" height="50" border="0"></center></h2><br>
<b>Skipper : </b>Richard Tibbs<br>
<b>Business Phone : </b>+44 (0) 1626 890418<br>
<b>Mobile/Boat Phone : </b>+44 (0) 7775 581972<br>
<b>Email : </b><a href="mailto:richard-tibbs@amserve.com">richard-tibbs@amserve.com</a><br>
</td>
</tr>
</table>
<!--------------- new table detail end ---------------------!>
</td>
<td bgcolor="#FFFFFF">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#3AC6EF"><img src="images/bottomleft_cor.gif" border="0"></td>
<td bgcolor="#FFFFFF">&nbsp;</td>
<td><img src="images/bottomright_cor.gif" border="0"></td>
</tr>
</table>
 
There is so many things wrong and/or outdated with this code that I don't really know where to begin. Try validating the page at online validator and try working from there. Also, be more specific. As I can see, your inner table is inside the middle of three cells of the outer table. Outer cells of outer table have images in them thus making sure they accomodate at least that picture. What exactly is this left margin you are experiencing? Good way to tell is add a border to outer table as well and observe where is the mysterious border appearing.
 
Thanks for the complements Vragabond, the first thing i tried was adding the borders in, thats hot i noticed the left margins. I'll put it through the online validator and see what it comes up with.

Also please can you tell me what wrong/outdated things are in this code. I know its not perfect (far from it), but its a dam site more of an achivement than making a page using dreamweaver (but i'm sure you've never done that).

Thanks again for the validator (i didn't even know they exsisted).

 
Ok, I've put it through the validator and as you said it has come up with alot of comments. (i'm not sure how valid it is though). i put googles homepage in there and it came up with more errors than mine?

I'm sure this rough left margin is something to do with my bad coding. Can you tell me or point me in the direction of a good tutorial site you recommend. I think my problem is in the definitions at the top of the html doc.

Thanks for replying.

Ian
 
Google is an authority in internet search, not html coding. I wasn't trying to put you down, merely let you know that the code can be problematic due to incorrect attributes. Validator should help you identify most of them, I am not at my computer at the moment and cannot test this problem fully. If you put your page online so that we can visually see the result, that would help a lot.

Your thinking is on the right track. First get your code right, then fix the display issues. At the top of the document you need a complete doctype to begin with. List of valid doctypes will help you there. In continuance, you could look at the w3 page for indepth workings of html (it also has some examples) but if you are looking for tutorials, I can suggest something like:
W3Schools - pretty basic html tutorials
A List Apart - great collection of html articles and techniquest (advanced)

I personally enjoy A List Apart a lot, but their articles/tutorials might look a little scary to beginners.
 
Thanks for the links, i'll look at them and get back to you.

Sorry if i seemed a little agro in the last post, you have been very helpful and it is appriciated.

Speak to soon.
 
I've uploaded the page with an example nested table at the bottom.

I've also inculded a definition at the top too.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

Which should be ok right?

Cheers
 
1. Check the link I gave for valid doctypes. Yours is not on that list, thus is considered incomplete and as such will not do its job -- shift browser behaviour from quirks to standards compliant mode.

2. Terrible, terrible. How long have we been circling around this problem and ignoring the obvious. I guess there's a lesson to be learned for all of us. I guess I assumed no stylesheets according to the code, but looking at the supplied link showed:
Code:
p,table,li,address
{
font-family: arial,"comic sans ms", 'sans serif';
margin-left: 15pt;
font-size:100%;
}
Now, do you think that margin-left: 15pt in the table declaration has anything to do with the fact that there is a margin of about 15pt on the left side of every table? Anyways, glad we found the problem.
 
Wicked! brilliant.....! thanks so much. (btw : i am kicking myself as we speak).

Like i said i'm quite new to this especially stylesheets, as soon as you said, i knew it (bit too late though).

I will change the doc info tag as well....

Thanks again,

Ian

 
minor point:

generic font families, such as serif, sans-serif, etc., should not be surrounded by quotation marks. Furthermore, the correct spelling is sans-serif, not sans serif.

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks cLFlaVA, useful.

Cheers

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top