WordPress.org

Ready to get started?Download WordPress

Forums

question about <pre> or <code> (3 posts)

  1. tcervo
    Member
    Posted 10 years ago #

    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.)
    Help!
    Thanks,
    Tony

  2. tcervo
    Member
    Posted 10 years ago #

    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 v100.colo1.aus.texas.net [209.99.121.5] is sending me into oblivion. So, I'm the only one that can't get to my own site!)

  3. NuclearMoose
    Member
    Posted 10 years ago #

    Tony,
    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??
    Craig.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.