Slurms
Slurms

Reputation: 199

HTML Table positioning and column spacing

In the "table style" portion of my code, is there a way for me to adjust the space between the columns in a table? Also, what attribute should I put in to make sure the tables position is aligned completely to the left and top?

<table style="width: 960px; height: 81px;" border="0">

Upvotes: 2

Views: 23375

Answers (3)

j08691
j08691

Reputation: 207900

For current and future compatibility use CSS:

// cellspacing
table { border-collapse:separate; border-spacing: 5px; }

To make sure the table is aligned to the left and top, remove any top and left margins. You might also want to change the positioning (position:relative or position:absolute) based on where the table need to exist.

Ref: border-collapse | border-spacing

Upvotes: 5

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114377

cellpadding controls the gaps inside cells and cellspacing controls the space between them.

<table style="width: 960px; height: 81px;" border="0" cellpadding="0" cellspacing="0">

As for alignment, you control this within table cells:

<td align="left" valign="top">

Upvotes: 0

Aghilas Yakoub
Aghilas Yakoub

Reputation: 28980

you can try with cellspacing property in order to create space

Upvotes: -1

Related Questions