Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CodeProject IE9
When I'm viewing articles on CodeProject (in IE9), <pre> blocks render with every line left-justified. If I copy and paste the code, it seems to have the spaces, though.
 
EDITORS: IF YOU MAKE THESE SNIPPETS "PRETTY", THE QUESTION MAKES NO SENSE. PLEASE *READ* BEFORE CHANGING FORMATTING. THANK YOU!
 
For example (and without using any code block tags so as not to hide the question about the error by invoking the error!), this html:
--------------------------------------------------------------------
<pre lang="cs">            <span class="code-keyword">protected</span> <span class="code-keyword">override</span> <span class="code-keyword">void</span> OnTextChanged(EventArgs e)
            {
                  <span class="code-keyword">base</span>.OnTextChanged(e);
                  <span class="code-keyword">foreach</span> (<span class="code-keyword">string</span> UnapprovedChars <span class="code-keyword">in</span> UnapprovedChar)
                  {
                        <span class="code-keyword">if</span> (<span class="code-keyword">this</span>.Text.Contains(UnapprovedChars))
                        {
                              <span class="code-keyword">this</span>.Text = <span class="code-keyword">this</span>.Text.Replace(UnapprovedChars, <span class="code-SDKkeyword">String</span>.Empty);
                        }
                  }
            }
      }</pre>
--------------------------------------------------------------------
 

 
Renders as:
--------------------------------------------------------------------
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
foreach (string UnapprovedChars in UnapprovedChar)
{
if (this.Text.Contains(UnapprovedChars))
{
this.Text = this.Text.Replace(UnapprovedChars, String.Empty);
}
}
}
--------------------------------------------------------------------
Clearly, this isn't desirable. Spaces should be significant in a <pre> block. I haven't chased down the styles being applied to the <span>s inside the <pre> block; they aren't applied to every line that gets mis-rendered, though.
 
Any idea what's going on? I assume most people don't see this?
Posted 22-Apr-11 9:23am
Edited 22-Apr-11 9:52am
v3
Comments
Seth Morris at 22-Apr-11 14:32pm
   
Please, don't edit the question unless you read it. Those two snippets should *not* be in code blocks.
 
Really.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You had the "Ignore HTML" checkbox checked (under the text entry field). I unchecked it and escaped the <pre> blocks your regular text, and it looks fine now.
 
If you select the Improve question link, you'll see what I did.
  Permalink  
Comments
Seth Morris at 22-Apr-11 14:34pm
   
I did look.
 
After your "improvement," the rendering on my machine was exqactlky the error I want to ask about--in both sections.
 
I left them plain for a reason: to show what the source was without the broken rendering. Turning on the rendering styles for it makes the question moot.
AspDotNetDev at 23-Apr-11 1:22am
   
It's an IE9 problem. Looks fine in all browsers, except in IE9 the indents are gone.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I have the same issue, on Internet Explorer 9.
 
Try use Chrome.
Or even the compatibilty mode of IE9 should do the trick (that icon shaped like a shredded sheet of paper, near the address bar, on the right).
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Ok. Thanks for informing.
This has been raised to CP Admins and they will look into it.
This is a similar thread reported: http://www.codeproject.com/Messages/3866045/Indents-Missing-from-PRE-blocks-in-IE9.aspx[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 329
2 BillWoodruff 210
3 Afzaal Ahmad Zeeshan 204
4 CPallini 185
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 23 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100