SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    UK
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing attributes of text within a table cell

    I would like to know how to alter the attributes of text within a table cell, when there is already an 'overall' set.

    ie:

    <td height="100%" width="528" align="left" valign="middle" class="content">
    &nbsp;&nbsp;If you wish to contact us, please do so using one of the following methods:
    &nbsp;&nbsp;<br><br>
    &nbsp;&nbsp;<b>Phone/b><br> <!-- attributes change on this line -->
    &nbsp;&nbsp;(020) 1234 1234
    &nbsp;&nbsp;<br><br>
    &nbsp;&nbsp;<b>Fax/b><br> <!-- attributes change on this line -->
    &nbsp;&nbsp;(020) 1234 1235
    &nbsp;&nbsp;<br><br>
    &nbsp;&nbsp;<b>E-mail/b><br>
    &nbsp;&nbsp;<a href="mailto:info@domain.com" class="mailto">info@domain.com</a>
    </td>

    -----

    Class .content is as follows :

    .content
    {
    &nbsp;&nbsp; font-size:12px;
    &nbsp;&nbsp; font-family:verdana;
    &nbsp;&nbsp; color:#88C8D8;
    &nbsp;&nbsp; text-decoration:none;
    &nbsp;&nbsp; font-weight:normal;
    }

    -----

    How can i change the marked lines using css instead of html used in this example ?

    I hope i explained the problem clearly.

    Thanks

    Azaar

  2. #2
    Former Staff Member silver trophy Adam P.'s Avatar
    Join Date
    Apr 2001
    Location
    San Francisco
    Posts
    3,288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Easy. Just create a class with the new attributes, for example:
    Code:
    .attribute2 {
       font-size:13px;
       color:#000000;
       text-decoration:underline;
    }
    And then apply this class to the <b> tag as so:
    Code:
    <b class="attribute2">Phone:</b><br><br>
    SPF Mentor/Advisor 2001-2003
    SPF Designer of the Year 2002
    SPF Graphic Designer of the Year 2003
    AdamPolselli.com

  3. #3
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    UK
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok, sounds easy enough, but what if i dont want to make that piece of text bold ? What if i just wanna make it 'red' for example ?

    Thanks for the help btw.

    Azaar

  4. #4
    Former Staff Member silver trophy Adam P.'s Avatar
    Join Date
    Apr 2001
    Location
    San Francisco
    Posts
    3,288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you just want to make it red, I would use the <p> tag to apply the class that you create.
    Code:
    <p class="attribute2">Your text here.</p>
    SPF Mentor/Advisor 2001-2003
    SPF Designer of the Year 2002
    SPF Graphic Designer of the Year 2003
    AdamPolselli.com

  5. #5
    Non-Member Siltrince's Avatar
    Join Date
    Aug 2001
    Location
    Belgium
    Posts
    304
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm hoping I'm not giving wrong information here but as far as know you can also use the SPAN tag:

    <span class="attribute2">your text</span>

  6. #6
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    UK
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you both, would <span> be better to use ? Does <p> not add a hard return at the end of the text ?

    Azaar

  7. #7
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was just about to ask a similar question...

    I dont want to put <span> around all my text in the cells though...

    I want like this

    .main td a:link

    so all links in td elements in dev .main are one set of properties

    is that possible?

    I want .main a:link to be a different set of properties


Bookmarks

Posting Permissions

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