Results 1 to 2 of 2

Thread: Text spilling out of the box in firefox

  1. #1
    Join Date
    Jul 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Text spilling out of the box in firefox

    Hi,

    Please, help me how can I have flexible box with background color in css that will expand according to the contents. Following is the test code that I have used, it is working in IE but in firefox contents come out of the box. I am looking for the cross browser fix for this:-

    The CSS File I am using contains the following:-

    div#content{margin-left:190px;margin-top:5px;}
    div.box
    {
    width: auto;
    min-width: 40px;
    border: 2px solid #781351;
    padding: 3px;
    background: #d7b9c9;


    white-space: nowrap

    }



    following is my html file:-

    <html>

    <head>
    <link href="test.css" rel="stylesheet" type="text/css" media="all" />
    <title>TEST PAGE</title>
    </head>

    <body>

    <div id="content">
    <div class="box">





    <H1>Sam</H1>
    <H1>Sam</H1><H1>Sam</H1><H1>Sam</H1><H1>Sam</H1>

    <p>The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology The technology </p>
    </div>
    </div>

    </body>

    </html>

    I know one fix is overflow:auto; property of css but this brings scroll bar in firefox which i don't want.

    Kindly, help as soon as possible.

    Thanks,
    sameer.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This is due to a bug in IE which causes an overflow:visible container to expand to accommodate its content, rather than drawing that content outside the container as the CSS standard specifies.

    You can try specifying the width of .box in ems. If I remember correctly, that will cause it to expand if necessary.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •