Fixed width div streching with text instead of wrapping

Posted on 2006-06-08
Last Modified: 2008-03-10
I have a div that I styled the width to 600px.  When I enter a long string of text, instead of wrapping it @ 600px, it streches out.  I was originally trying to make the div stretch to the size of the page, but got the same results (text going off the screen).  A solution for either the fixed width or strech would be great.
Question by:ibidata
    LVL 10

    Expert Comment

    Hi ibidata,

    Can you please paste your code here.


    Author Comment

    Let me know if you need more.


                      <!-- BEGIN PAGE CONTENT-->
                      <div id="pageContent">
                            ;asfdjkl;jkl;asfdjkl;asdjkfdakl;fja;dlfjl;kafjdadl;kfjal;jfdkl ;jafdfdasjklafdjklfdjkl;asfdasfdjkl
                            ;asfdjkl;asfdjkl;sfdjkl ;asfdjkl;asfdjkl;jkljkl;asfdjkl;jkl;asfdjkl;asdjkfdakl;fja;dlfjl;kaf  
                            kl;sfdjkl;asfdjkl;asfdjkl;jkljkl;asfdjkl; jkl;asfdjkl;asdjkfdakl;fja;dlfjl;kafjdadl;kfjal;jfdkl;jafdfd

                      <!-- END PAGE CONTENT-->

    LVL 30

    Accepted Solution

    > When I enter a long string of text, instead of wrapping it @ 600px, it streches out.
    It's called "overflow" and the default is "visible", which shows your overflowing content outside the container's bounderies.

    Wrapping is for words.  If you have very long words, then split them into some smaller pieces... you can use the <wbr> element for that (that's not part of the w3 standards, but all browsers support it).

    For an IE-only solution, you can use the css "word-wrap: break-word;":

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
    So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
    In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
    In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now