Support » Plugins and Hacks » question about <pre> or <code>

  • I know this is more of an XHTML/CSS question, but does anyone know how to properly display code fragments in a post, nicely styled, and still have it validate?
    For reference, check out this post.
    For the one-line fragments, I used the tag, nicely styled. This only works for a single line, it seems, and I don't want to have each line of a code block wrapped around it's own set of code tags.
    For the blocks of code on that post, I used the <pre> tag. This displays perfectly, but doesn't validate. I get:
    # Line 83, column 4: document type does not allow element "pre" here; missing one of "object", "ins", "del", "map", "button" start-tag
    Does anyone have a solution? (I still don't understand why "pre" isn't allowed. I tried it with a p tag wrapped around it, without a p tag wrapped around it...No idea why the validator is looking for object, ins, del, map, or button...that makes no sense.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s weird, I ran across another blog that was using the same markup (looks like), and it validates. The only diff was they used code inside of pre…I’ll have to try that when my site is back up. (Actually, my site was never down…it’s my connection/route from my ISP to my hosting company. Doing a traceroute tells me/us/them that between here and there, I’m getting sucked into a black hole in Austin, Texas. Specifically the handoff from [] is sending me into oblivion. So, I’m the only one that can’t get to my own site!)

    Both < p > and < pre > are block level elements in XHTML, so I don’t think that you should have them like that. Do you get exactly the same errors when the < pre > block is not inside the paragraph tags??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘question about <pre> or <code>’ is closed to new replies.