WordPress.org

Ready to get started?Download WordPress

Forums

applying different classes within a post? (5 posts)

  1. dss
    Member
    Posted 9 years ago #

    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?

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    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...

  3. dss
    Member
    Posted 9 years ago #

    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.)

  4. dss
    Member
    Posted 9 years ago #

    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.

  5. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.