Sign in to follow this  
Lode

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

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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 :(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this