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

J

J44xm

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
 
B

Barbara de Zoete

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 |
`-------------------------------------------------- --<--@ ------------'
 
D

Disco Octopus

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.
 
J

J44xm

["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.
 
R

rf

J44xm said:
["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.

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 :-(
 
J

J44xm

["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. :)
 
J

J44xm

["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!
 
T

Toby Inkster

J44xm said:
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.
 
B

Barbara de Zoete

["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 |
`-------------------------------------------------- --<--@ ------------'
 
J

Jukka K. Korpela

J44xm said:
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.

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.
 
J

J44xm

["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.

Indeed, the CSS option mentioned in another branch of the thread turned out
to be just what I wanted.
 
J

J44xm

["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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top