aspose file tools*
The moose likes Ranch Office and the fly likes inconsistent formatting of CODE blocks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "inconsistent formatting of CODE blocks" Watch "inconsistent formatting of CODE blocks" New topic
Author

inconsistent formatting of CODE blocks

Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
I've noticed that the formatting of CODE blocks varies a lot between browsers. Using IE at work it's in a pretty small font--almost too small. Using Opera on X.5 the font size is almost too large. I would expect some browser differences, though, and that is not in itself the topic of this post.

But I've also noticed that sometimes CODE blocks will have different formatting even within the same page. For example, when I view this page with Firefox 3.0β1 the CODE blocks in the original post use a small font while the CODE blocks in the first reply use a bigger font. (Actually, I have the same page open in two separate windows of that browser. One is as I describe, and in the other all CODE blocks use the smaller font. Go figure.)

I'm finally posting today, but I've noticed this for a couple of years now. Back then the smaller font was almost unreadable (this was mostly with IE on win2k), but on Firefox 3.0β1 the smaller font is nicely sized.

Anyway, any idea why this is happening?

----

Also while I'm here, allow me to point out that if you click on Today's Active Topics from the saloon's root page that it shows the first sentence or two of each post, which is nice.

But if you click on Today's Topics from the My Posts page you don't. Also, clicking on Yesterdays Topics doesn't seem to actually show yesterday's topics.
[ December 15, 2007: Message edited by: Brian Cole ]

bitguru blog
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11402
    
  16

i don't think that's exactly a fair comparison in the code blocks. in the second post, the code block in inside a quote block. i'm not surprised they're rendered differently.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Discussion on font size here in Firefox: http://www.coderanch.com/t/3064/Ranch-Office/why-do-code-tags-miniaturize and how to increase the text size for the code tags.

Discussion on better copy and paste:
http://www.coderanch.com/t/3307/Ranch-Office/Losing-format-copying-Code-Tags

Eric
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Originally posted by Brian Cole:
I'm finally posting today, but I've noticed this for a couple of years now. Back then the smaller font was almost unreadable (this was mostly with IE on win2k)

Anyway, any idea why this is happening?

And here is a discussion of one attempt to change the code size. This seemed to have greater effect in IE than any other browser for some unknown reason.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Fred Rosenberger:
i don't think that's exactly a fair comparison in the code blocks. in the second post, the code block in inside a quote block. i'm not surprised they're rendered differently.


That's a good point. But I have indeed seen non-quoted CODE blocks of different sizes on the same page. If I see it again I'll post here.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I think most likely you've seen that some code blocks come out in monospace font and some not. I'm aware of the problem. The code which generates that HTML has some problems, and the HTML it generates isn't strictly compliant, and can be rendered differently across different browsers. As I recall, there's a tendency to try to apply fonts across multiple block-level elements, which means some browsers assume implicit close-font tags at the end of a blcok, and some don't. Unfortunately, the code which governs this particular part of the HTML generation is among the most poorly-factored painful-to-read stuff in the codebase, and gives me a headache when I deal with it. We've made various alterations and (I believe) improvements over the years, but haven't been able to get all problems to go away, sorry.

I know Opera, Firefox and Safari make it easy for a user to increase font size on the fly, using shift-plus, ctrl-plus, or cmd-plus, respectively (replace plus with minus to decrease size instead). Dunno if IE has something similar, though I hope so. I use these often on web sites I visit, not just here. Hope that helps.


"I'm not back." - Bill Harding, Twister
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42273
    
  64
Originally posted by Brian Cole:
Also while I'm here, allow me to point out that if you click on Today's Active Topics from the saloon's root page that it shows the first sentence or two of each post, which is nice.

But if you click on Today's Topics from the My Posts page you don't.

Yes, the two pages are generated by different pieces of software, in a way that makes it tricky to show the actual text of the post on the second page you mention. That may change in the future, but probably not real soon.

Also, clicking on Yesterdays Topics doesn't seem to actually show yesterday's topics.

Are you saying this because some of the dates show "Today" instead of "Yesterday"? That's because some of the threads that were active yesterday have also been active today. The page doesn't just show threads started yesterday, it shows all threads that were posted to yesterday.
[ December 17, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inconsistent formatting of CODE blocks