Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML/css text in table cell not indenting

A simple question but large impact on appearance.

I want text indented from cell border and have tried style=text-indent: 4px (not formatted so it displays properly here) but while the first line is indented, the lines after the <br> tags are not indenting. Please help. I need to use div because of some Javascript. Here is flawed code:

<td>
   <div id="navbar" style="text-indent:4px"><b>View by:</b><br>
      <a href="search.php?cat=pop">Popular</a><br>
      <a href="search.php?cat=trend">Trending</a><br>
   </div>
</td>
like image 503
user1260310 Avatar asked May 31 '12 12:05

user1260310


2 Answers

text-indent is only supposed to touch the first line. Use margin (or margin-left or padding or etc) if you want to adjust the entire block.

like image 91
Quentin Avatar answered Oct 30 '22 14:10

Quentin


Try adding paddding to element, that holds your text you want to indent.

   <td style="padding:5px;">text</td>
like image 41
richardev Avatar answered Oct 30 '22 16:10

richardev