curiouswebster
asked on
How do I increase the column width?
I would like to extend the width of the columns. How do I do that?
newbieweb
<table>
<tr>
<td>Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95< /td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95< /td>
</tr>
<tr>
<td>Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95< /td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95< /td>
</tr>
</table>
newbieweb
<table>
<tr>
<td>Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95<
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95<
</tr>
<tr>
<td>Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95<
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95<
</tr>
</table>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Cool!
How do I pad the whole thing with spaces on the left? Or shift the whole table towards the center?
And how do I insert a blank line?
How do I pad the whole thing with spaces on the left? Or shift the whole table towards the center?
And how do I insert a blank line?
Here is how to center your table horizontally and insert a blank line
<table style="position: absolute; left: 50%; margin-left: -150px; width: 300px; text-align: left">
<tr>
<td width="100">Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
<tr>
<td colspan="3"> </td><!-- This is the blank line, and 3 is the number of columns of your table -->
</tr>
<tr>
<td width="100">Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
</table>
And this is the same table shifted 100px downwards.
Note also that I've replaced "position: absolute" by "position: relative". Depending on your situation, you should do the same (http://webdesign.about.com/od/advancedcss/a/aa061307.htm).
Note also that I've replaced "position: absolute" by "position: relative". Depending on your situation, you should do the same (http://webdesign.about.com/od/advancedcss/a/aa061307.htm).
<table style="position: relative; left: 50%; top: 100px; margin-left: -150px; width: 300px; text-align: left">
<tr>
<td width="100">Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
<tr>
<td colspan="3"> </td><!-- This is the blank line, and 3 is the number of columns of your table -->
</tr>
<tr>
<td width="100">Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
</table>
ASKER
I do not have your code working yet. Here's the way it loked with this kind of definition:
<table width="600">
Then second picture uses this kind of definition:
<table style="position: relative; left: 50%; top: 100px; margin-left: -150px; width: 600px; text-align: left">
and looks like in the second picture:
Can you suggest what I am doing wrong? I just want the table, which looks good, to shift the right a bit.
UnShiftedTable.JPG
ShiftedTable.JPG
<table width="600">
Then second picture uses this kind of definition:
<table style="position: relative; left: 50%; top: 100px; margin-left: -150px; width: 600px; text-align: left">
and looks like in the second picture:
Can you suggest what I am doing wrong? I just want the table, which looks good, to shift the right a bit.
UnShiftedTable.JPG
ShiftedTable.JPG
This code should do what you want:
Note that in my previous code, the table is centered if the margin-left value is half the table width. So if you want a 600px wide table, you must change the margin-left value to 300px.
Note that in my previous code, the table is centered if the margin-left value is half the table width. So if you want a 600px wide table, you must change the margin-left value to 300px.
<table style="left: 100px; width: 600px; text-align: left">
<tr>
<td width="100">Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
<tr>
<td colspan="3"> </td><!-- This is the blank line, and 3 is the number of columns of your table -->
</tr>
<tr>
<td width="100">Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95</td>
</tr>
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
<table>
<tr>
<td>Phone</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$29.95<
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95<
</tr>
// insert blank line here, betweenthe rows
<tr>
<td>Monthly Fee</td>
<td style="text-align: right; font-family: Courier New,Courier,mono;">$35.95<
<td style="text-align: right; font-family: Courier New,Courier,mono;">$99.95<
</tr>
</table>