I have a block of HTML code that generates a table displaying all the posts.
If there are no posts to display, I want to show an error saying No posts found
.
My current focus is on centering this error message within the table.
To achieve this, I have added some CSS styles:
<style>
table{border-collapse:collapse}
td{background-color:white;padding:10px}
.first_tr td{background-color:#f1f7f7 !important;border-bottom:1px red solid}
.error{ text-align: center; }
</style>
<table border="0" width="400px">
<tr class="first_tr"><td width="20%">POST ID</td><td width="79%">POST TITLE</td></tr>
<tr><td class="error">No posts found</td></tr>
</table>
For a working example, check out this link: http://jsfiddle.net/9UhTd/
The error message is now centered within the table, solving the alignment issue!