Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8585771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:08:58+00:00 2026-06-11T22:08:58+00:00

I have html code that prints all of the posts inside an html table.

  • 0

I have html code that prints all of the posts inside an html table.

However, if there are no posts then I need to print an error No posts found.

Now focus on the error message

I am trying to print the error message in the center of the table.

<style>
table{border-collapse:collapse}
td{background-color:white;padding:10px}
.first_tr td{background-color:#f1f7f7 !important;border-bottom:1px red solid}
</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>No posts found</td></tr>
</table>

Here is an example: http://jsfiddle.net/9UhTd/

The error message is shown in the begin of the table, but I am trying to center it!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:09:00+00:00Added an answer on June 11, 2026 at 10:09 pm

    To start with, you’re missing a colspan attribute on your second row’s only cell

    <table border="0" width="400px">
    <tr class="first_tr"><td width="20%">POST ID</td><td width="79%">POST TITLE</td></tr>
    <tr><td colspan="2">No user found</td></tr>
    </table>​​​​​
    

    Without it, that cell will only take up the space of the cell above it. With that resolved you can go on to center it how ever you please

    <table border="0" width="400px">
    <tr class="first_tr"><td width="20%">POST ID</td><td width="79%">POST TITLE</td></tr>
    <tr><td colspan="2" style="text-align:center">No user found</td></tr>
    </table>​​​​​
    

    or

    <style type="text/css">.center { 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 colspan="2" class="center">No user found</td></tr>
    </table>​​​​​
    

    Your jsfiddle with this implemented

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP code that generates a calendar and then outputs html to
I have this html code that i want to edit with jQuery. Here is
I have a block of HTML code that contains a button <button class=someButton onclick=openPage('test')></button>
I have the following html code: I saw that for Watir-webdriver the Watir::Image.file_size method
Below are the options that I have in my HTML code: <label id="subn"> <select
I have code that adds a pre-determined HTML snippet into a pre-determined <div> element
I have a code that is a mix of HTML and js. I cannot
I have a block of code that serializes a type into a Html tag.
I have a jquery line of code that outputs some HTML to a div.
The code that I have is as follows: <!DOCTYPE html> <html> <head> <script src=javascript/jquery.js

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.