I'm really getting frustrated with Blogger's inability to keep spacing when I provide well-indented code. It makes me want to not supply code samples. It makes me want to not post.
How do people successfully post code samples to Blogger? I could use some help. I don't feel any particular loyalty to Blogger, but making such a switch is always a pain.
Since I work for Google, I feel compelled to say: these are my own opinions and not those of my employer.
9 comments:
I write HTML by hand in my posts, with <pre> tags around my code to retain spacing.
I also setup prettify to add painless syntax colouring.
Ditto the above, although I'm using a self-hosted Wordpress.
Does Blogger have some sort of "code" pseudo tag?
I startied deleting 'div' tags, and using the previous 'p' as a sub w/ some success. I'm going to see if it gets even better by, using 'pre'
New Metamorphosis
asecondcup.blogspot.com
Did you have any luck with this? I have tried pre tags, but can't figure out how to prevent line wrapping in IE.
I too find it very frustrating. I can't believe some psuedo-code tag isn't built in...
I use some very elementary html, and it seems to circumvent the later versions to date. I have had very good luck (most of the time) with inserting the 'br' tag exactly where I want each line to break.
Thanks much for the follow up. I have had zero luck in the blogger groups on this topic ;)
Ideally it should display scroll bars for long lines of code instead line wrapping. But some versions of Internet Explorer don't seem to obey "overflow". Have you had any luck with this in any version Internet Explorer?
Try this CSS from java.net:
pre {
/*width:100% !important;*/
width: 600px; /*for IE, which doesn't obey !important or width:100% on pre*/
clear: both;
overflow: auto;
padding-bottom: 0 !important;
padding-bottom: 1.5em; /* for IE which doesn't make room at the bottom of the pre for a horizontal scrollbar */
}
swankjesse,
Thanks. I will give a try and let you know what happens.
Weird. It sort of works but it seems I can either have
- scrollbars and preserved indentation (good) but with line wrapping (bad)
or
- scrollbars with no line wrapping (good) but without preserving identation (bad)
I think the template CSS may be mucking things up, because that CSS should work ..
Post a Comment