1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Is <p>&nbsp</p> the same as <br />?

Discussion in 'HTML & Website Design' started by Tony Brar, Aug 8, 2012.

  1. #1
    Hello,

    Is <p>&nbsp</p> the same as <br />?
    (a simple yes or no will do)

    - Tony
     
    Solved! View solution.
    Tony Brar, Aug 8, 2012 IP
  2. #2
    no.

    <br/> or break is like enter so when you open the file there's just empty space which you can not select.


    while &nbsp is like the if you have pressed the space button on your keyboard so if you type <p>&nbsp</p> it will still look like emty space but you will be able to select part of it with your cursor.

    Anyway there is no visual difference but things like &nbsp are thought to be obsolete and will probably dissapear soon (next 4-5 years)
     
    latnemele, Aug 8, 2012 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #3
    only if you're a re-re writing idiotic bloated code using some sort of half assed WYSIWYG...

    P should wrap TEXT, you want a break between your text, that's padding or margin's job in the CSS.

    I just recently saw a steaming pile of a website for a PHP framework that was doing this type of idiocy:

    
    <p>Paragraph about something</p>
    <p>&nbsp;</p>
    <p>Another paragraph</p>
    <p>&nbsp;</p>
    <p>Another paragraph</p>
    
    Code (markup):
    Rendering the p with no margins/padding and then using the empty P to insert the blank line -- Which is just, sorry to say, rubbish idiotic markup written by someone who doesn't grasp what paragraphs are and/or are for. Of course that same trash website was using P+STRONG to do H2's job, P+NBSP+asterisks to do UL's job, and a whole host of other nonsense that showed the coder in question has no malfing business writing HTML in the first place.

    P is a perfectly good block level container -- margin it or pad it, don't waste markup on a blank line that your existing P should already be providing you!
     
    deathshadow, Aug 8, 2012 IP
    Bapinder likes this.
  4. aveh091112

    aveh091112 Peon

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i think..no..
     
    aveh091112, Sep 16, 2012 IP
  5. WebFerret

    WebFerret Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Remember HTML is meant to describe content. If you have a piece of text then it should normally be placed within <p> tags.

    As a general rule I try to avoid using <br> at much as possible. In fact, the only time I seem to use them is when creating contact forms etc.
     
    WebFerret, Sep 17, 2012 IP
  6. umeedngo

    umeedngo Peon

    Messages:
    96
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <br/> or break is like enter.
    <p>&nbsp</p> it will still look like emty space

     
    umeedngo, Sep 17, 2012 IP
  7. MrThind

    MrThind Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    No
    <br /> use for line break no extra space up & down
    <p>&nbsp</p> it will still look like emty space
     
    MrThind, Sep 18, 2012 IP
  8. arunt

    arunt Greenhorn

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #8
    <br /> - For line break
    <p>&nbsp</p> - it shows empty space
     
    arunt, Sep 20, 2012 IP
  9. php_developer

    php_developer Peon

    Messages:
    63
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    <br/> are used to break the line where as <p>&nbsp;</p> Browsers automatically add some space before and after each element.And also <p>&nbsp;</p> will take more space as compare to <br/>
     
    php_developer, Sep 22, 2012 IP
  10. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #10
    Except that most of the twits and ninnies using the non-breaking space inside the P (pay attention to that &nbsp;) have stripped padding and margins off their paragraphs, which is why said morons seem to think they need that extra markup -- they're using P incorrectly.
     
    deathshadow, Sep 22, 2012 IP
  11. alexkboorman

    alexkboorman Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #11

    I think I love you deathshadow. Let's be friends
     
    alexkboorman, Sep 22, 2012 IP