Non Breakable Hyphen

Discussion in 'CSS' started by forumposters, Mar 26, 2007.

  1. #1
    I have some code that replaces all spaces in a string with   and this worked great until I had a string with a '-' in it and the line is breaking at that when I don't want it to. Can I replace the '-' with something so that the line doesn't break at this hypen? What is the html code for a non breaking hyphen if it exists.
     
    forumposters, Mar 26, 2007 IP
  2. JoshuaGross

    JoshuaGross Peon

    Messages:
    411
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Enclose the text in <nobr></nobr>
     
    JoshuaGross, Mar 26, 2007 IP
  3. Rasczak

    Rasczak Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ... or in CSS, the parent (encasing) element should have the white-space property set to "nowrap"

    syntax: white-space: nowrap;
     
    Rasczak, Mar 27, 2007 IP