SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)

    Question long input messes up layout

    I'm not sure if this is the right place for the question, since it is the result of a mix of css, javascript and php, but I think it is.

    I use a html-template and a css file to create a layout without frames. One of the 'containers' is defined as follows:

    .leftcontainer {
    float:left; clear:both; width:13em; margin:0 0 1em 0; padding:0;}


    In this container i show the messages the users send one another. As long as the messages contain small words, everything goes well. When the sentence is too long, it automatically wraps around, and the layout remains ok.
    But, if someone (me ) writes a loooooooooooooooooooooooooooooooong word, the container adjusts its width to contain the long word, and thus invades the container in the middle of the window, defined like this:

    .content {
    clear:none; text-align:left; margin:1.2em 13.5em 0 13.5em; padding:0;}

    Is there a way (using CSS or HTML) to prevent the left container from expanding? Or must I use PHP or Javascript to split the long words into small pieces?

  2. #2
    Object Not Found junjun's Avatar
    Join Date
    Mar 2002
    Location
    northern MI
    Posts
    1,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since the word is too long for your container, and it can't automatically split up, your only(?) option is to hide the overflowing text:
    Code:
    .leftcontainer {
     float: left;
     clear: both;
     width: 13em;
     margin: 0 0 1em 0;
     padding: 0;
     overflow: hidden;
    }

  3. #3
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,501
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Great!
    Just what I needed. There is enough space for normal words, so the abnormal ones may be truncated without any regret. Thx junjun.


Bookmarks

Posting Permissions

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