dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: How do i position multiple css?

  1. #1
    Join Date
    Mar 2003
    Posts
    50

    How do i position multiple css?

    I have multipile external css that I would like to position to different areas.

    I have 2 tables and within these tables are fields. I have defined a css for the text fields as follows:

    INPUT, TEXTAREA {
    font-family: serif;
    padding: 2px;
    font-size: 13px;
    color: Black;
    font-weight: bold;
    text-align: left;
    border: 1px solid Black;
    }

    INPUT, TEXTAREA {
    font-family: serif;
    padding: 2px;
    font-size: 13px;
    color: Black;
    font-weight: bold;
    text-align: center;
    border: 1px solid Black;
    }

    INPUT, TEXTAREA {
    font-family: serif;
    padding: 2px;
    font-size: 13px;
    color: Black;
    font-weight: bold;
    text-align: right;
    border: 1px solid Black;
    }

    The properties of all the css are the same except the text-align. How do I make my first table use only the fist css and the second table that has 5 columns, use the second css in the first column and the third css in the 5th column.

    Please show me in code how this is achieved?

    Kind regards
    Darryn

  2. #2
    Join Date
    Dec 2002
    Location
    Göteborg, Sweden
    Posts
    93
    I would do something like this:

    Firstly, replace the code you posted with the following:

    INPUT, TEXTAREA {
    font-family: serif;
    padding: 2px;
    font-size: 13px;
    color: Black;
    font-weight: bold;
    border: 1px solid Black;
    }

    You see? I removed text-align: left;. Now add this to your CSS:

    .left { text-align: left; }
    .center { text-align: center; }
    .right { text-align: right; }

    ... and then add this to your HTML:

    (table number 1)

    <table class="left">

    (table number 2)

    <table>
    <tr>
    <td class="center"></td>
    <td></td>
    <td></td>
    <td></td>
    <td class="right"></td>
    </tr>
    </table>

    This may do it ... or not... I'm not 100% sure. You may want to move class="left" (and the other two class="... to the appropriate INPUT and TEXTAREA tags, like so: <input class="left"> (and so on...)

    Hope this will help you (at least a bit... )
    Cheers!

  3. #3
    Join Date
    Dec 2002
    Location
    High on life
    Posts
    10,104
    It would seem somewhat unclear as to what you are asking, as the styles that you have posted will be applied to input or textarea fields, not tables... Anyway, to give something a custom class, try this:

    <style type="text/css">
    .myclass { ... }
    </style>
    ...
    ...

    <textarea class="myclass"></textarea>

    Hope that helps...

  4. #4
    Join Date
    Mar 2003
    Posts
    50
    Thank you J. It works perfectly. My solution was adding the class property to the input tag.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles