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

  • Home
  • SEARCH
  • 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 6164089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:56:07+00:00 2026-05-23T21:56:07+00:00

I have an HTML table (styles with CSS) that is displayed in a JLabel.

  • 0

I have an HTML table (styles with CSS) that is displayed in a JLabel. I would like the contents (a single, short line of text) of the cells to be both horizontally and vertically centered. Horizontal centering is easy, but I cannot seem to center the text vertically. I’ve tried vertical-align: and valign: with both middle and center arguments. I’ve looked at several of the tricks, but none of them seemed doable, and the ones I tried didn’t work.

What I have now:

Inline (in the <style> tag) CSS:

table.outer {
    background:#F0F0F0;
    border-collapse:collapse;
    border:none;
}

td.outer {
    border-style:solid;
    border-width:1pt;
    border-color:#888888;
    padding:0pt 0pt 0pt 0pt;
}

table.inner {
    border-collapse:collapse;
    border:none;
}

td.title {
    width:75pt;
    background:#BFBFBF;
    padding:1.5pt 0pt 1.5pt 0pt;
}

The relevant portion of the HTML:

<body bgcolor=#F0F0F0>
<table class='outer'>
  <tr>
    <td class='outer' valign=top>
    <table class='inner'>
      <tr>
        <td class='title' rowspan=3>
          <p class='title'>Current Run</p>
        </td>
      </tr>
    </table>
    </td>
  </tr>
</table>
</body>
  • 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-05-23T21:56:08+00:00Added an answer on May 23, 2026 at 9:56 pm

    Support for HTML in Swing Components is limited to 3.2, but valign="middle" should work.

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

Sidebar

Related Questions

I have an HTML table that looks like this: ------------------------------------------------- |Column 1 |Column 2
I have a very specific html table construct that seems to reveal a Gecko
I have to build an HTML table that shows data for users versus pages
This one is weird, I have a page that consists of a html table
I have a HTML file that has code similar to the following. <table> <tr>
I have an html table <table border=0 width=100%> <tr class=headerbg> <th width=5%> No </th>
I have an html table which i bind data dynamically on the server side
I have an HTML table with several columns and I need to implement a
I have snippets of Html stored in a table. Not entire pages, no tags
Let's say I have the following HTML: <table id=foo> <th class=sortasc>Header</th> </table> <table id=bar>

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.