Submit Your Article Forum Rules

Results 1 to 6 of 6

Thread: CSS Question

  1. #1
    Moderator chrisJumbo's Avatar
    Join Date
    Oct 2005
    Location
    Near Sacramento, CA
    Posts
    789

    CSS Question

    I have been using the following to make some links behave differently than others and seems to be working fine.

    #p11 {font-family: "Times New-Roman"; padding-bottom: 2px; padding-top: 0px; padding-left: 3px;
    font-size: 11pt; font-weight: normal; word-spacing: 2px; text-align: left;}

    #p11 a:link {COLOR: #0000FF; TEXT-DECORATION: none; font-weight: bold}

    #p11 a:active {COLOR: #0000FF; TEXT-DECORATION: underline; font-weight: bold}

    #p11 a:visited {color: #A52549; TEXT-DECORATION: none; font-weight: bold}

    #p11 a:hover {COLOR: #0000FF; text-decoration: underline}

    Each line I want to do this, I have as
    <p id="p11">Some Text Link Text</p>
    <p id="p11">Some Text2 Link Text2</p>


    This works fine, but I read that you are only supposed to use an id once. I could wrap it under one big

    and insert
    to control the line breaks, but that doesn't seem to be a very clean solution either.

    I can't use a class, since that doesn't allow you to control the link behavior differently. Any ideas or just leave it?

  2. #2
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    You are correct that an id can only be used once, however you should be able to use a class as follows:

    .p11 {font-family: "Times New-Roman"; padding-bottom: 2px; padding-top: 0px; padding-left: 3px;
    font-size: 11pt; font-weight: normal; word-spacing: 2px; text-align: left;}

    .p11 a:link {COLOR: #0000FF; TEXT-DECORATION: none; font-weight: bold}

    .p11 a:active {COLOR: #0000FF; TEXT-DECORATION: underline; font-weight: bold}

    .p11 a:visited {color: #A52549; TEXT-DECORATION: none; font-weight: bold}

    .p11 a:hover {COLOR: #0000FF; text-decoration: underline}

    <p class="p11">Some Text Link Text</p>
    <p class="p11">Some Text2 Link Text2</p>

    If you find it doesn't then a test page would be most helpful in diagnosing the problem.

  3. #3
    Moderator chrisJumbo's Avatar
    Join Date
    Oct 2005
    Location
    Near Sacramento, CA
    Posts
    789
    I will give that a try. And if it doesn't work I will post a link to a test page.

    Thank you,

  4. #4
    Moderator chrisJumbo's Avatar
    Join Date
    Oct 2005
    Location
    Near Sacramento, CA
    Posts
    789
    Thanks speed. Success!

  5. #5
    Senior Member
    Join Date
    Aug 2003
    Posts
    294
    Yes,
    When Speed speaks, we listen.
    He's the man.
    Drummin
    Hello everyone! Newbie. Self-taught. Loves writing web-code.

  6. #6
    Moderator chrisJumbo's Avatar
    Join Date
    Oct 2005
    Location
    Near Sacramento, CA
    Posts
    789
    And that little tidbit, allowed me to greatly reduce my CSS. I was able to set a base behavior and then just change the items such as font-size, decoration, etc for the classes that needed something different.

Similar Threads

  1. Replies: 35
    Last Post: 07-25-2009, 11:11 AM
  2. Question
    By jonbyrd in forum IT Discussion Forum
    Replies: 3
    Last Post: 06-08-2008, 01:04 PM
  3. a question
    By Kinembe in forum Google Discussion Forum
    Replies: 1
    Last Post: 05-09-2007, 03:03 PM
  4. CSS Question
    By chrisJumbo in forum Web Programming Discussion Forum
    Replies: 5
    Last Post: 04-07-2007, 03:01 AM
  5. Another PR question
    By mmltonge in forum Google Discussion Forum
    Replies: 3
    Last Post: 03-30-2004, 08:06 PM

Posting Permissions

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