July 20, 2005

What's wrong with my CSS?

My <pre> styling looks OK (to me at least) in IE 6 and horrible (double spaced and strange) in Firefox. Can anyone tell me why?

The CSS looks like this:

pre {
color : #990000;
font : "Courier New", Courier, monospace;
font-size:small;
font-weight:normal;
padding : 5px;
line-height:100%;
}


Share this entry: Email it! | bookmark it! | digg it! | reddit!

Posted by Len at July 20, 2005 08:57 PM | Comments (4) | Categories : Geek Speak
Comments

The pre tag is for pre-formatted text. Which means that a LF character should cause a new-line, but you also have <p> and <br> tags inside there. So is the content pre-formatted or marked up?

Not sure what the other 'strange' problem you're seeing in Firefox is.

IE is probably just ignoring the HTML inside <pre>, either that or it's ignoring the CRLF's inside <pre> and using your markup.

Posted by: Mike at July 20, 2005 09:11 PM

Well, it's preformatted when I paste it into MovableType's edit window, I then add the <pre> tags around it. I guess that's not the way to do it...

Posted by: Len at July 20, 2005 10:41 PM

Ah, just remembered, I also have this in the CSS and I think I was told that this should have fixed the problem...

pre br { display: none }

I assume it means that if you see a <br /> within a <pre> tag then you don't display it? I think someone told me to do that the last time I asked a question like this...

Posted by: Len at July 20, 2005 10:47 PM

I think I've found a way around the problem. If a line in my <pre> block is empty then MT's processing makes it a <br /> which displays in an inconsistent way in IE and Firefox. If I add a space to each blank line then the <br />s aren't generated and the problem goes away...

Hardly ideal, I think I need a better way to put code into these postings, anyone got any suggestions?

Posted by: Len at August 3, 2005 08:14 AM
Post a comment









Remember personal info?




Enter this code in the box below to prove that you're not some kind of automated spam robot...