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.

text wrap in div

Discussion in 'HTML & Website Design' started by solidsoul2010, Feb 11, 2014.

  1. #1
    how can I stop the text in this div from going outside the element?
     

    Attached Files:

    solidsoul2010, Feb 11, 2014 IP
  2. bhuthecoder

    bhuthecoder Member

    Messages:
    245
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    43
    #2
    use below css
    word-wrap: break-word;
    Code (markup):
     
    bhuthecoder, Feb 11, 2014 IP
    deathshadow likes this.
  3. AlbCoder

    AlbCoder Well-Known Member

    Messages:
    126
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    163
    #3
    create a new class called content in css and give the width becausein html you have <div class="content"> but in css codes you have nothing about that
    I give you an example:

    .content {
        width:350px;
        padding:15px 0;
        text-align:left;
        color:#fff
    }
    Code (markup):
     
    AlbCoder, Feb 11, 2014 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    @bhuthecoder has it right... break-word (which was 'just' added in HTML 3 in 'modern' browsers, but also works all the way back to IE 5.0) will ... break the word up as needed.

    IE5, doing what CSS3 calls "new" since 1998.

    No clue what the blue blazes @AlbCoder is prattling on about.

    Though I'm hoping the fixed size and fixed metrics is just for testing, since that's accessibility trash...
     
    deathshadow, Feb 12, 2014 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    Wouldn't any 'normal' text include some whitespace, e.g. spaces?

    An unbroken string of characters is seldom (ever?) a reasonable test argument. Try using a lorem ipsum string.

    cheers,

    gary
     
    kk5st, Feb 12, 2014 IP
  6. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #6
    I'd be assuming that's a testcase for some really long words and not the actual data... though that could hinge on your definition of normal... :D

    Given the ridiculously tiny fixed width, it's a legitimate concern if you have constantly changing data -- you never know when you might want to use the word "pneumonoultramicroscopicsilicovolcanoconiosis" or "pseudopseudohypoparathyroidism" -- proper chemical names regularly break the "magic 78" barrier... some get absolutely massive, like the proper chemical name for the protein "titin" which weighs in at almost 190K characters long.

    ... or one could just be trying to fit the text of Mary Poppins in the page -- "supercalifragilisticexpialidocious"

    Though a more common concern is cross OS compatible filenames (no spaces) or usernames where the user is being a pain in the ass (a common blight upon forums).
     
    deathshadow, Feb 12, 2014 IP
  7. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #7
    If it were the case of needing support for ungainly, specialty words, I'd expect the OP to mention it. Without that clarification, my working hypothesis is that a poor choice of test text is the root of his problem. One should expect horses rather than zebras upon hearing hoof beats; unless on the Serengeti.

    cheers,

    gary
     
    kk5st, Feb 15, 2014 IP