SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Wizard jag5311's Avatar
    Join Date
    Jan 2003
    Location
    Somewhere in Indiana
    Posts
    3,082
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using <pre> with a 100px wide div doesn't work

    I am looking at the layout design from Glish.com
    http://glish.com/css/1.asp

    and just realized that if you try to take the right menu and make it like 120px or even 100px, the text goes OUT of the div. It does this for all browsers except IE 6.0. Its because of the <pre> tag.

    ANy reason why?

  2. #2
    SitePoint Addict BenANFA's Avatar
    Join Date
    Apr 2003
    Location
    Bath, UK
    Posts
    353
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because <pre> ... </pre> text is preformatted and white space appears exactly as it is in the html file so the lines of text do not get resized for the div's smaller size.

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,556
    Mentioned
    183 Post(s)
    Tagged
    6 Thread(s)
    Hi,

    If you place an element inside another element and the inner element has a larger width than the outer then IE6 treats the outer width as minimum width and will expand to compensate.

    Other browsers handle it correctly and just let the content spill out.

    The pre content obviously has a set width that is larger than the outer element and so IE6 expands the div to fit. (It would happen with any inner element that is larger than the outer element.)

    Paul


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
  •