How do I make my words stay together?

Discussion in 'CSS' started by mnymkr, Jun 18, 2006.

  1. #1
    Say I have a topic like "Alternative Medicine" , when the browser is smaller the two words break apart. Is there anyway for CSS to tell the words to stay together no matter what?
     
    mnymkr, Jun 18, 2006 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    white-space: nowrap;
    Code (css):
     
    digitalpoint, Jun 18, 2006 IP
  3. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #3
    is that something that is best placed in the body tag?
     
    mnymkr, Jun 18, 2006 IP
  4. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #4
    ok not exactly the desired effect i need

    basically my setup is like a directory

    Section

    topic, topic, two word,
    topic, topic, topic

    this is how i would want it ideally.

    placine the code in body tag

    gives

    Section

    topic, topic, two word, topic, topic, topic

    Placing it in the a:link does something similar
     
    mnymkr, Jun 18, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    
    Alternative Medicine
    Code (markup):
    Simply replace a normal space character with a non-breaking space character.

    cheers,

    gary
     
    kk5st, Jun 18, 2006 IP
  6. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #6
    Thank Gary,

    I had thought about that but the directory style is generated dynamically so there is not a way, at least that I know of, to tell it to put those charcters in.

    Is the nowrap something I can use in a <td> , if so , I sure can't get it to work.
     
    mnymkr, Jun 19, 2006 IP
  7. AdamSee

    AdamSee Well-Known Member

    Messages:
    422
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    135
    #7
    $topic = str_replace(' ','&nbsp;',$topic);
    Code (markup):
    Something like this would work in PHP - changing all spaces in a topic name to '$nbsp', but it really depends how much coding experience you have.
     
    AdamSee, Jun 19, 2006 IP
  8. mnymkr

    mnymkr Well-Known Member

    Messages:
    2,328
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    120
    #8
    yeah that looks rough for me...i would really like to handle it with stylesheets if I can.....this script is done with tables so is there a style for <td>
     
    mnymkr, Jun 19, 2006 IP
  9. JudyJiaStyle

    JudyJiaStyle Well-Known Member

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #9
    How about using the no-wrap style in a <div> or <span>? Put those two words in a <div> and use the css code.
     
    JudyJiaStyle, Jun 20, 2006 IP