Reply to Re: What's wrong with this HTML (fails validation) ?

Your name:

Reply:


Posted by Steve Pugh on 02/15/07 09:20

On Feb 14, 10:17 pm, rem6...@yahoo.com (robert maas, see http://
tinyurl.com/uh3t) wrote:
> > From: "Andy Dingley" <ding...@codesmiths.com>
> > So close your elements with an end tag.
>
> If I do that, validation fails. Should I just ignore validation failure??

Not if you do it correctly.

First you need to ask yourself if you are writing XHTML or HTML. Where
and how you close elements varies between the two. So you must be 100%
consistent to the rules of whichever one you are using. Starting with
inclduing either an HTML or XHTML doctype.

I think that most of the original problems have come from mixing the
two formats in one document and then getting more and more confused
when peopel tried to help you out.

> > Your code examples are one of the few cases when <pre> might well
> > be appropriate, ...
>
> Is there any way to have a code example like that with both the
> preceding and following text directly adjacent to it, no blank line
> either before or after the code example?

Without using CSS?

In XHTML:
<p>text<br /><code>example</code><br />text</p>
In HTML:
<p>text<br><code>example</code><br>text</p>

However, I would use pre + css and accept the blank lines for the tiny
minority of people who view the page in Lynx. Unless you are the only
visitor to your site, you have to accept that your view is very far
from what most people will see.

> > > And just that one fix makes it fail validation already!! How do I
> > > force a line break, **without** a blank line, in the middle of a
> > > paragraph, in transitional XHTML??
> > <br />
>
> That starts a NET, which is **not** the semantics I want!!

Not in XHTML it doesn't. There's no such thing as a NET in XHTML.

And a NET is not semantics - it doesn't alter the meaning of the
element at all - <p/text/ means exactly the same as <p>text</p>.

In XHTML use <br /> and in HTML use <br>. That's it. That's how to
create a valid and working line break in the two languages.

Steve

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация