Center align form elements in css

Posted on 2011-10-13
Last Modified: 2012-05-12
How do I do this?

In the "olden days", you just said <td align="center"> & everything is center aligned.
Question by:Richard Korts
    LVL 4

    Accepted Solution

    If you're using CSS, it'd look like:

        text-align: center;

    Open in new window

    LVL 2

    Expert Comment

    I'd recommend you add a class to your table, e.g.
    <table class="my-table"...</table>

    Open in new window


    Then you can add a CSS rule to center content in the TD's:

    .my-table td {
      text-align: center;

    Open in new window


    Author Closing Comment

    by:Richard Korts
    That's exactly what I had; EXCEPT I closed it (accidentally) with ) instead of }.

    You got 500 easy points; that part now works.

    Featured Post

    Course: HTML5 for Beginning Beginners

    Are you looking for an efficient introduction to HTML5? Have you tried other HTML5 courses and found them too complex? Do you need just the basics of HTML5 to use with Wordpress or other content management system? If you said yes to any of these questions, this course is for you.

    Join & Write a Comment

    So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
    In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now