Support » Themes and Templates » applying different classes within a post?

  • I’ve been working on applying a class called “highlight” to various paragraphs within posts (WP 1.2)
    so far the only method which has actually worked is as follows:
    <table><tr><td id="highlight">This is a test of the highlight class.
    Highlight class is a special class designed for making a portion of the text pop out at you. This is my fifth attempt at making a paragraph appear within a post using a special class to determine its look.</td></tr></table>
    I really don’t want to use tables, but so far, SPAN, P, DIV don’t work.
    does anyone know what am i overlooking?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Can you post an example to your blog with code that doesn’t work ?
    I can’t see why a p class shouldn’t work…

    I wrote it up for you, and in so doing i answered my own question.
    see for yourself
    curious.
    not the result i expected (obviously.)

    and yet, in my examples the class and id are not interchangable.
    i read up at php.net and discover that class is for a single use, and id is for multiple uses.
    no matter, it works, and it’s a cool trick!
    thanks for the poke to action, i needed it.
    F.

    Moderator Michael Adams (mdawaffe)

    (@mdawaffe)

    Member

    You were right the first time; you now have class, and id backward. Id should be a unique name; the same id should never be used twice. Classes can be used multiple times. The problem was not with your HTML markup, but with your CSS. Classes should be specified with periods (as alphaoide mentioned):
    .highlight {color... }
    id’s are specified with hashes (#)
    Hope this helps.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘applying different classes within a post?’ is closed to new replies.