SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru kili's Avatar
    Join Date
    Jan 2004
    Location
    Damn I need a Crap
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cant get class to work?

    Hi Guys I have the code below for my mainbody pharagraphs I cant get it to work I want differenet settings for diffrent pharagraphs but no joy. Can I use class= for pharagraphs?

    Code:
    .mainbody P { color:#003366; font:10px Verdana; sans-serif; text-align: justify;}

    I have this for my html but it dont work.

    Code:
    <p class="mainbody"> some text </p>
    Can someone be kind enough to point me in the right direction please

    Cheers Kili

  2. #2
    SitePoint Member tommylynn's Avatar
    Join Date
    Oct 2004
    Location
    allen, tx
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    change your css to just read - .mainbody {..... and you've got a semi-colon between font faces instead of a comma.

  3. #3
    SitePoint Guru kili's Avatar
    Join Date
    Jan 2004
    Location
    Damn I need a Crap
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks tommylynn.

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    ohio
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just to follow up on this the way you had it originally written basically stated that any paragraph <p> within the class of mainbody is to inherit that style rule you specified.

    In other words, it would have worked if you had the HTML as this

    <div class="mainbody">
    <p>
    Hey guess what this class works now!
    </p>
    </div>

    Tommylynn basically showed you the correct way of writing the css. However just to get a bit more deeper into it, lets say you wanted that style ONLY apply to paragraphs. You would write your css as:

    p.mainbody
    {
    color:#003366; font:10px Verdana, sans-serif; text-align: justify;
    }

    Then you HTML would look like

    <p class="mainbody">
    This is it..
    </p>

    I just thought I throw that in there so that you could understand WHY it wasn't working instead of just throwing a solution in there as well.

    HTH,

    Michael


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
  •