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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Body and Table CSS problem

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
I want to set the margins for body in <style> tags but im not having any luck with left-margin: 0; etc. any ideas? Im having a similar problem of it not working when I try to remove padding and spacing between cells in a table. Can any one help me please?
 
can we see some code?

[Hammer]
Nike Failed Slogans -- &quot;Just Don't Do It!&quot;
 
<html>

<head>
<style &quot;text/css&quot;>
<!--
body { leftmargin: 0; right-margin: 0; topmargin: 0; bottom-margin: 0; }
table.main { width: &quot;100%&quot;; border: 0; cell-padding: 0; cell-spacing: 0; }
td.banner { width: &quot;100%&quot;; }
td.ltoc { width: &quot;33%&quot;; }
td.body { width: &quot;33%&quot;; }
td.rtoc { width: &quot;33%&quot;; }
td.footer { width: &quot;100%&quot;; }
-->
</style>
</head>

<body>

<table border=&quot;1&quot; width=&quot;100%&quot;>
<tr>
<td class=&quot;banner&quot; colspan=&quot;3&quot;>&nbsp;</td>
</tr>
<tr>
<td class=&quot;ltoc&quot;>&nbsp;</td>
<td class=&quot;body&quot;>&nbsp;</td>
<td class=&quot;rtoc&quot;>&nbsp;</td>
</tr>
<tr>
<td class=&quot;footer&quot; colspan=&quot;3&quot;>&nbsp;</td>
</tr>
</table>

</body>

</html>


Id also like to get the colspan parameter in the style tags if at all possible. Thanx
 
OK i worked out margins and padding (margin-left: 0 etc.) but what about colspan and cellspacing?
 
i usually define those in the respected tables, i rarely have colspan greater than 1 as i try and keep everything very symetrical and in tables. but cellspacing is simple just make your tag like such

<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;1&quot; cellpadding=&quot;0&quot;>

cellspacing is of course space between cells whereas cellpadding is space taken up in a cell

so a td with width 50 and cellpadding 2 would essentially have a width of 4.

another thing, maybe its just me but i never assign classes to tables, i just assign them to <td> or <tr> but moreso to <td>

[Hammer]
Nike Failed Slogans -- &quot;Just Don't Do It!&quot;
 
i know but i want it as CSS, does any one know how?
 
I updated and said i worked out margins and padding. i tried padding-left etc then thought about just padding yeah. but and for cell spacing, column span?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top