Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  • Thread Tools
  • Rate This Thread
  1. #1
    New to the CF scene
    Join Date
    May 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Break word on post view

    I don't really know how to explain my problem, I hope you will understand.

    When somebody posts something (large), normaly the next word goes on the next row but I want the word to go completly there not like this
    Code:
    test tes
    t test te
    st
    I already use Break-word.
    Code:
    .media-body {
        max-width: 80%;
        word-wrap: break-word;


    IMAGE: http://i.imgur.com/9mmxaAL.png

  2. #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,864
    Thanks
    6
    Thanked 1,164 Times in 1,135 Posts
    If you don’t want the words to break then you should not use word-wrap: break-word, i. e. remove this if you want words to go to the next line completely and not break.

  3. #3
    New to the CF scene
    Join Date
    May 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If I use no break, this will not go to the next line... will be one line only.

  4. #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    9,864
    Thanks
    6
    Thanked 1,164 Times in 1,135 Posts
    OK, then we need to see your code (HTML and CSS) as there could be numerous reasons why this is happening. If I’m guessing instead of word-wrap: break-word; you should use white-space: normal; (I’m assuming that somewhere there could be a white-space: nowrap; rule you need to override).

  5. #5
    Regular Coder
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    365
    Thanks
    1
    Thanked 50 Times in 47 Posts
    The behavior you're looking for -- breaking the word if it's too big to fit the ENTIRE line -- while wrapping if it's small enough to fit, simply does not exist.

    There are only two real behaviors:

    1) word-wrap:normal -- which breaks when and only when there's whitespace.

    2) word-wrap:break-word which will ALWAYS wrap WHEREVER it needs to wrap regardless of where spaces are.

    Technically the white space property can add a third behavior, "PRE" which obeys all characters contained within literally, but that's really not related to what you are asking.

    if you wanted for example a 18 character wide break, so that

    aaaaaaaaaaaaaaaaaaaaaaaaa

    is displayed as:

    aaaaaaaaaaaaaaaaa
    aaaaaaa

    BUT you want:

    test test test test test test

    To display as:

    test test test
    test test test

    and not:

    test test test te
    st test test


    CSS and HTML can't do both at the same time, it's one or the other. You either break at whitespace ONLY, or break at the width limit ONLY, there is no in-between.
    From time to time the accessibility of websites must be refreshed with the blood of designers and owners; it is its natural manure.
    http://www.cutcodedown.com

  6. #6
    New to the CF scene
    Join Date
    May 2016
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want to go next line then you can use break keyword with tags like <br>. Break tag is used for break for one line.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •