Search code examples
cssxhtmlhtmlxhtml-1.0-strict

Text Overflow Problem & Text Non Wrap


Scenario: One header DIV with three DIV's inside side by side floated left.

Problem: "Text" from HEADER_A div is overflowing into HEADER_B DIV and so on.

Screenshot / CSS:

alt text http://thumb0.webshots.net/t/74/174/8/92/12/2239892120105349420zNlkOc_th.jpg

#header{
height:127px;
width: 718px;
}

#header_a {
    width:181px;
    height: 127px;
    color:#FFFFFF;
    float:left; 
}

#header_b{
width: 363px;
float:left;
height: 127px;
/*background-image:url(../images/logo.jpg);*/
background-position:bottom;
background-repeat:no-repeat;
background-color:#006600;
}

#header_c{
width: 174px;
float:left;
height: 127px;
}

<div id="header">
      <div id="header_a">ddddddddddddddddddddddddddddddddddddddddddddddddddddddd</div>
        <div id="header_b"></div>
        <div id="header_c"><img src="images/nuevo.png" /></div>
    </div>

Solution

  • ddddddddddddddddddddddddddddddddddddddddddddddddddddddd is > 181px.

    Its obviously going to overflow because its taken as a single word and words are not broken up. Try using some proper text or give some space like "ddddddddddd ddddddddddddd ddddddddddddddddd dddddddddddddd"

    EDIT:

    on the other hand the same will happen to images. So anything within the div that is larger than its parent will overflow. you can try using 'overflow:hidden'