Headers within <PRE> is not standards-compliant; alternatives?

Discussion in 'HTML' started by J44xm, Feb 17, 2005.

  1. J44xm

    J44xm Guest

    On my Web page, I have text laid out using a <PRE> tag. However, when I
    validate my page, I'm told that header tags -- in my case, <H1> and <H2> --
    aren't allowed within <PRE>'s. Is there a way to retain my preformatted
    layout and use header tags but within the HTML standard? Or will I just have
    to live with not be standards-compliant in this case?

    Reference: http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html
    --
    J44xm, who urges all to quote previous posts judiciously
     
    J44xm, Feb 17, 2005
    #1
    1. Advertising

  2. On Thu, 17 Feb 2005 16:39:57 -0600, wrote:

    > On my Web page, I have text laid out using a <PRE> tag. However, when I
    > validate my page, I'm told that header tags -- in my case, <H1> and <H2> --
    > aren't allowed within <PRE>'s. Is there a way to retain my preformatted
    > layout and use header tags but within the HTML standard? Or will I just have
    > to live with not be standards-compliant in this case?
    >
    > Reference: http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html


    I don't really understand why you use pre for this. It is a bunch of lists. Why
    not mark them up as such. Whith lists you can put headers in between all you
    want. And you can use CSS to set the font type and use of white space property
    to match this <pre> look easily.

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 17, 2005
    #2
    1. Advertising

  3. J44xm wrote :
    > On my Web page, I have text laid out using a <PRE> tag. However, when I
    > validate my page, I'm told that header tags -- in my case, <H1> and <H2> --
    > aren't allowed within <PRE>'s. Is there a way to retain my preformatted
    > layout and use header tags but within the HTML standard? Or will I just have
    > to live with not be standards-compliant in this case?
    >
    > Reference: http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html


    instead of the <pre> you can try <div style="white-space:pre">.

    try it.

    --
    eating alone is medicinal
     
    Disco Octopus, Feb 17, 2005
    #3
  4. J44xm

    J44xm Guest

    ["Barbara de Zoete"; Thu, 17 Feb 2005 22:44:53 GMT]

    > I don't really understand why you use pre for this. It is a bunch of
    > lists.


    This list was originally a plain-text list. I want to exactly duplicate the
    layout of the original text file. This, for one, allows me to copy and paste
    the text back into a text file, for one. Thus, <PRE> is my best option.
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 17, 2005
    #4
  5. J44xm

    J44xm Guest

    ["Disco Octopus"; Thu, 17 Feb 2005 23:50:50 GMT]

    > instead of the <pre> you can try <div style="white-space:pre">.


    Thanks for the reply. Looks great in Firefox but IE6 doesn't handle it
    correctly. While how my document appears in IE is a secondary concern to me,
    I'm afraid the result is downright illegible in this case!

    See: http://www.2and2.net/Uploads/Images/msie-dislikes-this.png
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 18, 2005
    #5
  6. J44xm

    rf Guest

    "J44xm" <w44kz[@]friragl8.a_g> wrote
    > ["Barbara de Zoete"; Thu, 17 Feb 2005 22:44:53 GMT]
    >
    > > I don't really understand why you use pre for this. It is a bunch of
    > > lists.

    >
    > This list was originally a plain-text list. I want to exactly duplicate

    the
    > layout of the original text file.


    Sticking an <h1> element in the middle of it is *not* exactly duplicating
    the layout of the original text file.

    > This, for one, allows me to copy and paste
    > the text back into a text file, for one. Thus, <PRE> is my best option.


    Pre is not your best option if you want to put a <h1> element in the middle
    of it.

    And BTW I fully expected to be able to click on those links. The way it is I
    will never know what is in them :-(
     
    rf, Feb 18, 2005
    #6
  7. J44xm

    J44xm Guest

    ["rf"; Fri, 18 Feb 2005 00:05:28 GMT]

    > Sticking an <h1> element in the middle of it is *not* exactly
    > duplicating the layout of the original text file.


    Fair enough. :)
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 18, 2005
    #7
  8. J44xm

    J44xm Guest

    ["J44xm"; Fri, 18 Feb 2005 00:01:28 GMT]

    > Thanks for the reply. Looks great in Firefox but IE6 doesn't handle it
    > correctly.


    Cancel that! I found the error in my coding. Looks like that's the answer to
    my problems! Thanks much for your help!
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 18, 2005
    #8
  9. J44xm

    Toby Inkster Guest

    J44xm wrote:

    > On my Web page, I have text laid out using a <PRE> tag. However, when I
    > validate my page, I'm told that header tags -- in my case, <H1> and <H2> --
    > aren't allowed within <PRE>'s. Is there a way to retain my preformatted
    > layout and use header tags but within the HTML standard? Or will I just have
    > to live with not be standards-compliant in this case?


    Instead of this:

    <h1>....</h1>

    Do this:

    </pre><h1>....</h1><pre>

    Easy.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Feb 18, 2005
    #9
  10. On Thu, 17 Feb 2005 17:56:00 -0600, wrote:

    > ["Barbara de Zoete"; Thu, 17 Feb 2005 22:44:53 GMT]
    >
    >> I don't really understand why you use pre for this. It is a bunch of
    >> lists.

    >
    > This list was originally a plain-text list. I want to exactly duplicate the
    > layout of the original text file.


    Why not serve out the original text file then? Putting the headers in disturbs
    this idea of your anyway.

    > This, for one, allows me to copy and paste
    > the text back into a text file, for one.


    Any file will do that. Open the file in your browser --> [Ctrl]+[A] -->
    [Ctrl]+[C] --> open text editor --> [Ctrl]+[V]; presto

    > Thus, <PRE> is my best option.


    Rubbish.

    --
    ,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
    | weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
    | webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
    |zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
    `-------------------------------------------------- --<--@ ------------'
     
    Barbara de Zoete, Feb 18, 2005
    #10
  11. J44xm <w44kz[@]friragl8.a_g> wrote:

    > On my Web page, I have text laid out using a <PRE> tag. However, when I
    > validate my page, I'm told that header tags -- in my case, <H1> and
    > <H2> -- aren't allowed within <PRE>'s.


    That's pretty natural, and in any case that's what the specs say.

    > Reference: http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html


    What's the point of writing a collection of URLs in nominally HTML format?
    What could possibly be the point of using <span class="link"> instead of
    real links? Worrying about presentation or validity is rather
    disproportionate here.

    In a real link list, you have URLs in href attribute values, not in link
    texts. The link text says, in prose, what the referred document is about.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Feb 18, 2005
    #11
  12. J44xm

    J44xm Guest

    ["Barbara de Zoete"; Fri, 18 Feb 2005 08:04:53 GMT]

    > Why not serve out the original text file then? Putting the headers in
    > disturbs this idea of your anyway.


    I did originally, but I wanted some formatting added as well. Clearly,
    adding HTML messes up my original text, but the output is still laid out
    exactly like plain text, for easy copying-and-pasting.

    > Any file will do that. Open the file in your browser --> [Ctrl]+[A] -->
    > [Ctrl]+[C] --> open text editor --> [Ctrl]+[V]; presto


    What I meant was that by retaining the exact layout of the original text
    file, including the tabs, I could copy the HTML-formatted text right back
    into a text file without losing anything. (In the screenshot available at
    http://www.2and2.net/Uploads/Images/freeware.png, this is exactly what I
    did, and this precisely mimics my original text file.) This works in IE but
    not Firefox at the moment.

    >> Thus, <PRE> is my best option.


    > Rubbish.


    Indeed, the CSS option mentioned in another branch of the thread turned out
    to be just what I wanted.
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 18, 2005
    #12
  13. J44xm

    J44xm Guest

    ["Jukka K. Korpela"; Fri, 18 Feb 2005 11:35:44 GMT]

    > That's pretty natural, and in any case that's what the specs say.


    Fair enough.

    > What's the point of writing a collection of URLs in nominally HTML format?


    Because I'm looking to mimic a plain-text file, but with some formatting
    options too. It's not intended to be a normal HTML file.

    > What could possibly be the point of using <span class="link"> instead of
    > real links?


    I should note that page is still in development. I'm just feeling out
    options. A text file was too plain, a standard HTML file was too much
    trouble to edit for various reasons, and at the moment, this admittedly
    unusual hybrid fits what I'm seeking.

    > In a real link list, you have URLs in href attribute values, not in link
    > texts. The link text says, in prose, what the referred document is about.


    Yes, I'm quite aware of this.
    --
    J44xm, who urges all to quote previous posts judiciously
    <http://osx.soc.uh.edu/~jdavis/j44xm/freeware.html>
     
    J44xm, Feb 18, 2005
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?S2V2aW4gQnVydG9u?=

    Pre-Send Request Headers, Pre-Send Request Content

    =?Utf-8?B?S2V2aW4gQnVydG9u?=, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,063
    =?Utf-8?B?S2V2aW4gQnVydG9u?=
    Dec 31, 2004
  2. Jim Royal
    Replies:
    3
    Views:
    355
    Jim Royal
    Sep 16, 2003
  3. Replies:
    0
    Views:
    371
  4. Kenny McCormack

    Is this standards compliant?

    Kenny McCormack, Dec 30, 2004, in forum: C Programming
    Replies:
    7
    Views:
    287
    Chris Croughton
    Dec 31, 2004
  5. jzakiya

    W3C Standards Compliant

    jzakiya, Jul 7, 2009, in forum: Ruby
    Replies:
    6
    Views:
    184
    Sam Duncan
    Mar 10, 2011
Loading...

Share This Page