<br /> tag working inconsistently

Discussion in 'HTML & Website Design' started by 13baby, Nov 28, 2011.

  1. #1
    I'm coding a web site using XHTML 1.0 and CSS and on some pages, my <br /> tag inserts a break AND a space, and in others, it inserts just a break - now, I can clutter up my coding with extra tags, but I don't like to do that - I'm relearning all of this and I'm sure it's completely simple. Examples:

    <div align="center"><h1>Title</h1></div><br />
    <h3><b>TERM</b> this sentence defines the term.</h3>
    <br /><h3>This is some more stuff that defines the term.</h3>
    </div>

    Above coding is fabulous. Breaks, spaces between title and paragraphs. It works.

    Then there's this:


    <h3><b>Bold Name of Project</b><br /> for client<br /></h3>
    and then, because my div works, we have the defining features in paragraph form down here without any need for pesky tags.

    except for some reason on THIS page the <br /> is only breaking the line and not inserting a space.

    If it matters, they're both hooked into the same div element on the stylesheet. I feel like a moron. The end.

    Thanks!
     
    13baby, Nov 28, 2011 IP
  2. 13baby

    13baby Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    And as a response to my own question (I'd like to know if I'm correct, but my troubleshooting seems to have garnered some results) -

    It actually matters whether the <br /> is at the end of the line (where it will leave linebreak, no space) and at the beginning of the new line (where it leaves a line break and a space)??? Has it always been this way? Is it because of the HTML editor I'm using?

    And to continue with an edit - it doesn't seem that the above "fix" is correct - I have the <br /> at the end of one line in the first example (that works the way I want it to, though only because I WANT a space in that case, I'd like to be able to do both) and the beginning of another and they both insert spaces.
     
    13baby, Nov 28, 2011 IP
  3. 7thand43rd

    7thand43rd Member

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #3
    It must be something with your text editor, the <br /> doesn't enter a space along with the line break. Also, you shouldn't need a line break within any header (<h3>), as it is a block element and will create its own line break per say.
     
    7thand43rd, Nov 28, 2011 IP
  4. Toycel

    Toycel Peon

    Messages:
    243
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    0
    #4
    HDGwebdev is right the space is caused by the H3 tag that you have. you won't need a <br /> after the H3 tag as it does this itself
     
    Toycel, Nov 29, 2011 IP
  5. leanocodes

    leanocodes Member

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #5
    I suggest using CSS instead of <br> tags for design. :)
     
    leanocodes, Nov 29, 2011 IP
  6. 13baby

    13baby Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I am using CSS for design, this is solely for the large blocks of text I'm putting on the page. Thank you!! I'll fiddle with the header tags once I figure out how to make my forms work properly. :D
     
    13baby, Nov 29, 2011 IP
  7. Cyvre

    Cyvre Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I personally dislike using the <br> tag :p btw, u shud indent ure code so that its a lot easier to read :D
     
    Cyvre, Nov 30, 2011 IP