tags:

views:

105

answers:

5

how can I have an indention here:

sorry for the ambiguity of my question, i want to have indention between the "9.00" and the border from the left. please check the link i included here:

http://img714.imageshack.us/i/spacing.png/

 <table border="1">
  <col width="100" />
  <col width="300" />
   <tr>
   <td> 9.00 </td>
   <td> Name Name Name Name Name<br/>
   Greetings Greetings </td>
    </tr>
   </table>
+7  A: 

Use CSS margin and padding.

Thariama
+1  A: 

Looks like what you want can be achieved by (1) center align the text or (2) pad the text. One way to do this (but there are better ones) is to give the <td> elements an align=center attribute.

 <table border="1">
  <col width="100" />
  <col width="300" />
   <tr>
   <td align="center"> 9.00 </td>
   <td align="center"> Name Name Name Name Name<br/>
   Greetings Greetings </td>
    </tr>
   </table>

Caveat: this will work but is outdated. You are much better off using Cascading Style Sheets.

Manoj Govindan
thanks...;-) but I will only integrate short html in the css. i know css is quite better than this.. yes this is somehow related to my other question. but just wanted to make the time "9:00" a quite, an indention
tintincute
thanks the "td align="center" > works but what if I don't want to have it in the center I just would like to have a small space between the border and the 9.00 let's say maybe 1cm... is it possible?
tintincute
+1  A: 

If you want to use CSS you can say:

<style type="text/css">
.paddingClass td {
    padding: 0 10px;
}
</style>

And on the table add the class:

<table border="1" class="paddingClass">
    <col width="100" />
    <col width="300" />
    <tr>
        <td>9.00</td>
        <td>
            Name Name Name Name Name<br />
            Greetings Greetings
        </td>
    </tr>
</table>
Sour Lemon
Beware that `padding: 0 10px;` (top/bottom, left/right) will add padding on the left _and_ right; use `padding-left: 10px;` or `padding: 0 0 0 10px;` (top, right, bottom, left) instead for only indentation.
Alec
I always use padding: 0 10px; for stuff like that. My reason being that if I don't want it to touch the left border, then I won't want it to touch the right one either. But thank you for adding the warning :)
Sour Lemon
+1  A: 

Remember that when the HTML is rendered all "white space" is reduced to a single space character. You can manually force additional spacing with the &nbsp; character entity, so you could simply do:

<tr>
    <td>&nbsp;&nbsp;&nbsp;9.00</td>
    <td>
        Name Name Name Name Name<br />
        Greetings Greetings
    </td>
</tr>

Yes, it is grossly ugly - but if you just want a "quick and dirty" way, try it.

Ken Ray
this is very very quick and dirty sorry...
tintincute
found solution already that would be padding-left
tintincute
@tintincute - yes, incredibly dirty - I feel slightly soiled for even suggesting it. But, there are times when you want to space something just a little, and that is quick, and certainly browser independent. But the css solution is the best.
Ken Ray
+3  A: 

In addition to all the other answers, can I point out the simplest solution:

p {
  text-indent: 1em; /* will indent the first-line of a paragraph by 1em */
}
David Thomas