Possible Duplicate:
How do I format my code blocks?

How do I write HTML in my post without it getting "translated"?

I would like to be able to show you guys my raw code. Hope you can help me out with this noobish problem.


  <p>Here is some markup</p>
  <p>I typed it out, highlighted it, and clicked the code button.
  You know the one with the curly braces { }
  • 2
    what does translated mean and please do show the relevant part of your code – Ibu Aug 23 '12 at 18:03

Either surround your code with backticks (for inline code) or indent each of your lines of code by at least 4 spaces. Or hit the code format button. It looks like a set of braces. So, it'd look like this:

SpaceSpaceSpaceSpace <html>

SpaceSpaceSpaceSpaceSpaceSpace <head> //will look correctly indented

SpaceSpaceSpaceSpaceSpaceSpace //lots of html

SpaceSpaceSpaceSpaceSpaceSpace </head>

SpaceSpaceSpaceSpace </html>

Ok, maybe that's overkill.

  • 1
    this should be a comment. – Ibu Aug 23 '12 at 18:06
  • 3
    @Ibu pardon me if this sounds rude, but... what? This is a direct answer to his question. In no way should it be a comment. If this should be a comment, the question isn't possible to answer, and thus shouldn't be on here (which may indeed be the case) – Phillip Schmidt Aug 23 '12 at 18:07
  • @Ibu, why? It's an answer to the guy's question surely? – stephenmurdoch Aug 23 '12 at 18:07
  • @lbu Just to pile on, this is most certainly an answer to the question. (I flag lots of "Not an Answer" posts, and I wouldn't dream of flagging this one) – Andrew Barber Aug 23 '12 at 18:20
  • You could also wrap it in <pre> tags. – Servy Aug 23 '12 at 18:24
  • @Servy in response to your edit comment - obviously your IDE just doesn't have enough dimensions :) – Phillip Schmidt Aug 23 '12 at 18:26
  • @PhillipSchmidt Where's the link to Chrome 3D? I'm totally in. (God I hope I don't need to start developing 3D websites. 2D is bad enough.) – Servy Aug 23 '12 at 18:27
  • @Servy well, first you gotta go buy a 3D monitor and subscribe to SO-3D – Phillip Schmidt Aug 23 '12 at 18:28
  • @Servy but on a serious-er note, I found out yesterday that webkit actually supports css3 3D transformations. Cool, huh? – Phillip Schmidt Aug 23 '12 at 18:29
  • @Ibu what are you talking about? – Aaron Bertrand Aug 23 '12 at 18:40
  • Ibu thinks this is an actual Stack Overflow question and you're trying to tell him how to format code, so he thinks it should be a comment. – Mystery Aug 23 '12 at 18:47
  • Nope, @Servy, <pre> is just to preserve whitespace. It does not encode HTML entities. So one would need to type <pre>&lt;html&gt;...&lt;/html&gt;</pre> then. Markdown code blocks are much easier. – Arjan Aug 23 '12 at 19:19

highlight your code, and press control+k

  • assuming you have a control key, if not, press the apple button or whatever it is – stephenmurdoch Aug 23 '12 at 18:08
  • 2
    No sense in commenting on your post to add content if you can edit it :) – Phillip Schmidt Aug 23 '12 at 18:10

Not the answer you're looking for? Browse other questions tagged .