html, css

In a td tag, I want to display the following at center like:

                        John Doe
                       First Player

The code below displays (left):

John Doe
First Player

       <td id="nameAlignment">
              <span id="name"">John Doe</span><br/>
              <span id="title">First Player</span>
        </td>

#name{
  font-size:2em;
  font-family:"Tahoma","sans-serif";
  font-weight:bold;
  color:rgb(89,89,89);
  white-space: nowrap;
}
#title{
  font-size:1.1em;
  font-family:"Tahoma","sans-serif";
  font-weight:bold;
  color:rgb(84,142,212);
  white-space: nowrap;
}
#nameAlignment{
  
}

Open in new window

LVL 34
Mike EghtebasDatabase and Application DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kyle HamiltonData ScientistCommented:
#nameAlignment{
  text-align:center;
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi Kyle,

I had tried this code before but it only centers it at its box it adds to it not in the td tag.td
0
Kyle HamiltonData ScientistCommented:
see this fiddle:

http://jsfiddle.net/93ktcyfc/3/

If your text is not centered, then you must have something else going on which is not in the snippet you posted.

Please either post a link to the page, or adjust the fiddle to reflect your actual html.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Mike EghtebasDatabase and Application DeveloperAuthor Commented:
my bad, I needed to add colspan="3" elsewhere. This missing attribute was causing the problem.

Thanks,

Mike
0
Kyle HamiltonData ScientistCommented:
np :)
0
Kyle HamiltonData ScientistCommented:
Just some closing comments. With the caveat that I have no idea what it is you are actually working on :)

Avoid using ids for styling. IDs should only be used for unique elements that need to be accessed by scripts.
Styling should be done with classes.

Do not use tables for layout. This is a deprecated technique. Tables should only ever be used for actual tabular data.

I will not go into details here, but you can search the web for the reasons why, as well as best practices for developing modern websites.
0
Mike EghtebasDatabase and Application DeveloperAuthor Commented:
Hi Kyle,

I appreciate for the good comments you have made. I have made a resume in MS Word. Now, I am converting it to html. To tell the truth, it was a bit too complicated for me to go from table to div.

I will have few followup questions which I am preparing to post. I will send you a link, if it is okay with you, so I can benefit from your good comments.

Regards,

Mike
0
Kyle HamiltonData ScientistCommented:
sure. np
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.