my <P> become classes

Discussion in 'Web Design and Development' started by pelsar, Dec 23, 2008.

  1. pelsar macrumors regular

    Joined:
    Apr 29, 2008
    Location:
    israel
    #1
    all i want to do is between paragraphs have some spacing via CSS...yet when i do a return i get a new class

    <p class="general_text">

    if i do shift return <br> all is well, but that doesnt give me the solution of flexible spacing....which brings me up the next question...what the CSS tag for spacing between paragraphs.

    any idea what i 'm doing wrong?

    (with tables it was so easy......)
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    You should supply more information, like what application you're using because it sounds like the app is getting in your way. Spacing between paragraphs is a simple thing,
    Code:
    p {
     margin: 0 0 1em 0;
    }
    This will create a gap of one line below each paragraph. Margins and padding can be described using 4 numbers like here, which are ordered as: top, right, bottom, and left. The 1em, if you aren't familiar, means 1 line height. You can also using decimal measurements and also pixels (px) values.
     
  3. werther macrumors regular

    Joined:
    May 15, 2006
    #3
    Code:
    p { margin: 0 0 1em 0; }
    mnemonic device to help remember: TRouBLe
    T for Top, R for Right, B for Bottom, and L for Left.

    This also applies for padding, borders and whatever else I am forgetting.
     
  4. kgarner macrumors 68000

    kgarner

    Joined:
    Jan 28, 2004
    Location:
    Utah
    #4
    Technically it's the height of the text. You can specify a different line-height for a <p> (like 1.5 em) and if you want that line-height to be the space between your paragraphs you have to specify the margin at 1.5em as well.

    To the OP, we definitely need more info, because it sounds like the program you are using is doing something weird. A browser should not be adding in <p>'s for you by itself.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    Yea, you're right. I was just trying to phrase things in a way that would make sense to the OP.
     
  6. pelsar thread starter macrumors regular

    Joined:
    Apr 29, 2008
    Location:
    israel
    #6
    thanks guys....and i hate to admit it.

    there may be some advantages of the div/shmiv/class stuff over my traditional "table system".

    using the "P" for margin spacing (thanks angelwatt for keeping it simple...), that i read above, i added that to the style sheet then, i set up a different text block with a different class, with that new "p" which worked..then copied and pasted those paragraphs into the "problem div" which worked fine and then just changed the text to the proper txt and all is working....(i suppose thats 'cheating' but it did work)

    and the program i'm using?...Dreamweaver CS4 (and im keeping the coding window open on my second screen.....
     

Share This Page