I am trying to place padding for the table so that it looks good. but how?

index.php

<table border="0" width="300px">
<tr style="background-color:#ede6c9; color: black;">
<td>
<?php

// How can we help

$result = mysql_query("SELECT * FROM `static_page` WHERE post_id='27'") or die(mysql_error());

echo '<td>';
while ($data = mysql_fetch_array($result)){
       $isi = $data['isi_berita'];
       echo '<h2>'.$data['judul'].'</h2><br><br>';
       echo substr($isi, 0, 1000).'<br>';
}

?>
</td>
</tr>
</table>

Recommended Answers

All 6 Replies

Do you mean padding:5px;? You can apply padding to the table, table rows, table cells, etc. You might need to explain a little more, or perhaps provide some example.

I know the code, I just do not know where to place the padding at? (so that the code shows exactly like as it suppose to be)

so that the code shows exactly like as it suppose to be

Eh? I'm not really sure what you mean by the above comment. You set the padding on the element you want padding on, there really isn't anywhere it is "supposed to be". Or are you asking if you should put it inline (like you already did with your table row), or in a stylesheet (like you really should be doing).

tr{background-color:#ede6c9; color: black;}

Member Avatar for diafol

@davy_yg

For the millionth time - please stop posting every single question into the PHP forum - and I've repeatedly shown/told you how/why to style with css.

Do you ever take notice of anything we tell you?

Sorry, I am feeling grumpy, but come on.

Post moved...

which element do u want to add the padding if its table

table {padding:5px}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.