...

View Full Version : <pre> in IE



IFeelYourPain
05-09-2009, 10:12 PM
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?

SB65
05-10-2009, 09:48 AM
I'd guess it's an absent or incorrect doctype causing the issue in IE.

IFeelYourPain
05-10-2009, 05:03 PM
I'd guess it's an absent or incorrect doctype causing the issue in IE.

How can I fix that?

SB65
05-10-2009, 05:27 PM
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 (http://www.alistapart.com/articles/doctype/).

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


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

IFeelYourPain
05-12-2009, 09:53 PM
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 (http://www.alistapart.com/articles/doctype/).

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


<!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. =[

SB65
05-12-2009, 10:32 PM
Here's some basic code that works in IE - the text appears on two lines.


<!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.

timgolding
05-13-2009, 12:16 AM
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
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum