[web] white-space:pre not working in IE?

Started by
9 comments, last by GameDev.net 19 years, 7 months ago
I'd like to use the css element "white-space:pre;", but it appears not to work for IE, only for all other browsers. It's not that I use IE or anything, but there are still enough people left using it for me to want my site to look good for them too. Is there a way to let white-space:pre; work for IE?
Advertisement
I've no idea what that command should do, but for IE to handle CSS properly to need to set the proper doctype. If you're already doing that, I have no more suggestions.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
The command does the same as the <pre> tag, I can use that instead but IE also does something wrong with that (put an extra line break behind it that no other browser does) making something look a little bit ugly.

All the rest of the css code is working properly, so it's really just that one tag that IE doesn't want to support, and too bad if IE doesn't support something it means web designers can't use it, even though it's the standard :(
Hey I just found an example of a site with the same problem as me:

http://www.cplusplus.com/doc/tutorial/tut1-1.html

Their code tables: in IE, there's an extra line break at the end of each table, in all other browsers there isn't. I find the extra line break very ugly. Is there some way to eliminate it for IE?

The reason for the extra line break in IE is because it always places one after the pre command :(

Thanks.
Does a <div> work with the CSS setting the font to monospace?
Ra
How exactly are you using the tag?

white-space: pre should be supported in IE 5 and above link

As Extrarius correcly said, you can fix a lot of these sort of problems with the correct DOCTYPE
going to move this to web dev

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Hey thanks for the doctype link. I set it to XHTML 1.0 instead, and now it renders correctly in IE too.

However, now I have another problem:

I want a table to be centered, and the code in it NOT centered. I place center tags around the table, and with HTML 4.01, then the table was centered, but the content inside the table was not. In XHTML 1.0 however, the content inside the table is centered too! How can I fix this? Is there maybe some css style that I can use instead for the table that'll center it (and not it's contents)?

Also it's a disaster now, I checked it with w3's validator and even small pages are full of errors, appearantly even <br /> tags aren't allowed, unless there's a p tag, and I have no p tags at all in my page. It's going to be HOURS of work to make it valid XHTML 1.0... or does there exist a tool that can do this automaticly?
The only way to get good valid XHTML is to slave over it. It's hard work to port a site over, especially if you're slack with your original HTML to begin with. There probably is a tool, but I wouldn't know of one ;)

In XHTML, the behaviour you see is valid, it's down to the cascading nature of the style sheets. To correct this, set the text-align: left; style attribute on the table.
Oh noooo :(
HTML really is full of problems:

in XHTML 1.0, white-space:pre; works in IE and such, but there's a problem with it NEVER AUTOMATICALLY WRAPS! thereby destroying the tables :(
I found there exists a property white-space:pre-wrap; instead, but guess which browser doesn't support that yet? That's right, IE :(

EDIT: only opera supports pre-wrap appearantly...

[Edited by - Lode on September 3, 2004 6:18:47 PM]

This topic is closed to new replies.

Advertisement