Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: <pre> in IE

  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    264
    Thanks
    19
    Thanked 0 Times in 0 Posts

    <pre> in IE

    I'm using CSS to fix my content so that it will properly display txt files:
    white-space: pre;

    However this does not work in IE.

    Ideas?

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    I'd guess it's an absent or incorrect doctype causing the issue in IE.

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    264
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SB65 View Post
    I'd guess it's an absent or incorrect doctype causing the issue in IE.
    How can I fix that?

  • #4
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    You need to add the doctype statement right at the start of your html code - have a look at the sticky thread at the top of the board for some references, or try this site.

    The doctype will depend on how you've written your html, but it will look something like this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Posts
    264
    Thanks
    19
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SB65 View Post
    You need to add the doctype statement right at the start of your html code - have a look at the sticky thread at the top of the board for some references, or try this site.

    The doctype will depend on how you've written your html, but it will look something like this:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    I've tried everyone of them listed on that website. No result. =[

  • #6
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,950
    Thanks
    9
    Thanked 724 Times in 718 Posts
    Here's some basic code that works in IE - the text appears on two lines.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Pretest</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <style type="text/css" media="screen">
    p{white-space:pre}
    </style>
    </head>
    
    <body>
    <p>Some 
       text</p>
    </body>
    </html>
    Hope this helps.

  • #7
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    Arrow

    But you will have to put these codes in each of the popups or use a popup.php like the one i provided in the other thread with this stuff in that.

    PHP Code:
    <?php
    if(isset($_GET["file"]))
    {
       
    $file=$_GET["file"];
       if(!
    preg_match('#^/files/[A-Z]/(^/)\.txt$#'$file))
       exit;
    }
    else exit;
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Pretest</title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <style type="text/css" media="screen">
    p{white-space:pre}
    </style>
    </head>

    <body>
    <p>
    <?php
       
             $str 
    file_get_contents($file);
             echo 
    $str
    ?>
    </p>
    </body>
    </html>
    So you have a choice you either use the codes i provided in either of the two threads or you have to copy and paste SB65's code in each of your 100's of popups. But if your going to do that you might as well just put <br> in instead!

    For anyone who wonders what an earth I'm talking about look here
    http://codingforums.com/showthread.php?t=165918
    Last edited by timgolding; 05-12-2009 at 11:21 PM.
    You can not say you know how to do something, until you can teach it to someone else.


  •  

    Posting Permissions

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