vertical cell spacing

liunx

Guest
Hi,

I've got following code:



<table border="0" cellpadding="0" cellspacing="0">

<tr>
<td>My name<td>
</tr>

<tr>
<td>My address<td>
</tr>

</table>



Question: What code do I have to put in my stylesheet to manage the space between "my name" and "my address"?

Cheers,
PieterI guess I don't understand what's wrong with

<p>My Name</p>
<p>My Address</p>

or maybe

<dl>
<dt>My Name</dt>
<dd>My Address</dd>
</dl>

or even

<p>My Name</p>
<address>My Address</address>

any of which would be more correct than a table and they give you plenty of styling fodder.Well, Ray, I think he was simply giving an example. padding (<!-- m --><a class="postlink" href="http://www.w3schools.com/css/css_padding.asp">http://www.w3schools.com/css/css_padding.asp</a><!-- m -->)(foo {padding: Npx;}) would manage the space around the cells contents, but still inside the cell, and margin (<!-- m --><a class="postlink" href="http://www.w3schools.com/css/css_margin.asp">http://www.w3schools.com/css/css_margin.asp</a><!-- m -->) (foo {margin: Npx;}) would manage the space around the outside of the cell, pushing elements away, or pushing the cell itself around, depending on the context.Hi Omega,

Thanks for the tips. Also the margin attribute helped me with another problem.

Cheers,
PieterHi Ray,

If I shouldn't use a table. How do I get columns lined out?

Cheers,
PieterI'll field that, seeing as I have nothing better to do.

Well, are the columns you speak of meant to hold data? If not, use divs to divide your page into sections, and then you can compose a simple layout out of:

CSS:
#container {width: 795px; margin: 0 auto;}
#header {height: 100px; width: 100%; background: url(header.jpg) no-repeat;}
#header span {display: none;}
#content {width: 68%; float: left;}
#nav {width: 30%; float: right;}
#footer {clear: both; width: 100%;}
...
<html>
<head>
...
</head>
<body>
<div id="container">
<h1 id="header"><span>Header</span></h1>
<div id="content">
...
Content here
...
</div>
<div id="nav">
...
Navigation here
...
</div>
<div id="footer">
Footer Info here
</div>
</div>
</body>
</html>
EDIT: Example (<!-- m --><a class="postlink" href="http://projep.no-ip.com:81/test/examples/basic-layout.html">http://projep.no-ip.com:81/test/example ... ayout.html</a><!-- m -->)Hi Omega,

Thanks for the reply. Only.. the link doesn't work :eek:

Cheers,
PieterYes, I know, I'm wrestling with my host to work for others right now.Originally posted by pieterh
Hi Ray,

If I shouldn't use a table. How do I get columns lined out?

Cheers,
Pieter The simple <p> should resulting in left alignment. Inclosing the <p>s in a <div> will give you a hook to attach specific styles to if you need a variety.
 
Back
Top