[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to format the first column of my table using CSS

Posted on 2014-08-28
2
Medium Priority
?
115 Views
Last Modified: 2014-08-29
I have a web page that has a two-column layout.  Inside the left column I have a table with 2 columns.  I want to format the first column to have the text right-justified but can't get the CSS to work.  I know there is a way to do this without having to put a class on each <td> of the table but haven't figured it out.  Any help is greatly appreciated!

HTML:
        <div id="FixedArea">
            <div id="GeneralGuidelines">
                <h2>General Guidelines for Referral Type Name</h2>
                <textarea style="width: 100%" cols="1" rows="5">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </textarea>
            </div>
            <div id="RequesterInfo">
                <h2>Requester Info Area</h2>
                <table class="RequesterInfoTable">
                    <tr>
                        <td>Name</td>
                        <td>Employee Name</td>
                    </tr>
                </table>
            </div>
        </div>

Open in new window


CSS
#FixedArea
{
    width: 100%;
    background-color: #ccc;
    padding: 5px;
    overflow: auto;
}
#GeneralGuidelines
{
    width: 50%;
    padding: 5px;
    float: right;
}
#FixedArea h2
{
    font-weight: bold;
    font-size: small;
    padding: 0px;
    margin: 0px;
    text-align: center;
}
#GeneralGuidelines textarea
{
    font-size: smaller;
}
#RequesterInfo
{
    width: 50%;
    font-size: smaller;
}
.RequesterInfoTable
{
    width: 100%;
    border: 1px;
}
.RequesterInfoTable td
{
    width: 50%;
}

Open in new window

0
Comment
Question by:dyarosh
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 40291139
.RequesterInfoTable tr td:first-child {
    text-align:right
}

Open in new window

0
 

Author Closing Comment

by:dyarosh
ID: 40293373
Thank you!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Suggested Courses
Course of the Month20 days, 12 hours left to enroll

865 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