Results 1 to 16 of 16

Thread: is this valid HTML?

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    is this valid HTML?

    <ul><li><font color="#FF8080">item 1</li><li>item 2</li><li>item 3</font></li></ul>
    or typically anything of this form: <A><B></A></B>
    it occurs here
    http://www.vbforums.com/showthread.php?t=352267
    Opera, IE and FF seem to handle it just fine, but is that HTML?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  2. #2
    Frenzied Member
    Join Date
    Aug 2005
    Posts
    1,042

    Re: is this valid HTML?

    kedaman:

    Yes it is HTML and it displays a list:

    item 1
    item 2
    item 3

    in red text.

  3. #3
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: is this valid HTML?

    Quote Originally Posted by kedaman
    <ul><li><font color="#FF8080">item 1</li><li>item 2</li><li>item 3</font></li></ul>
    or typically anything of this form: <A><B></A></B>
    it occurs here
    http://www.vbforums.com/showthread.php?t=352267
    Opera, IE and FF seem to handle it just fine, but is that HTML?
    No no no, that HTML is not valid. It is badly formed. Tags should be closed in the oppisite order to which they are opened. Also, in the most recent version of HTML, the font tag has been deprecated.

    .e.g:
    <b><i>hello</b>how are you</i>
    Is not well formed.

    <b><i>Hello</i> how are you</b>
    Is well formed.

    The corrected version should look like this. You would use CSS, in the parent ul element to set the font color for ALL child elements.
    HTML Code:
    <ul style="color: #FF8080">
        <li>item 1</li>
        <li>item 2</li>
        <li>item 3</li>
    </ul>
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  4. #4
    Addicted Member Lemon Lime's Avatar
    Join Date
    Jul 2000
    Location
    Space, the final frontier, go along the yellow brick road,turn left then left again. In the service window, ask for the insane dude.
    Posts
    167

    Post Re: is this valid HTML?

    try
    HTML Code:
    <font color="#FF8080">
    <ul>
       <li>item 1</li>
       <li>item 2</li>
       <li>item 3</li>
    </ul>
    </font>
    I've had enough with sainity!
    What's the use of it anyway?

  5. #5
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: is this valid HTML?

    Quote Originally Posted by Lemon Lime
    try
    HTML Code:
    <font color="#FF8080">
    <ul>
       <li>item 1</li>
       <li>item 2</li>
       <li>item 3</li>
    </ul>
    </font>
    No, you shouldn't. I realise that vBulletin and other forum systems spew them out, but the font tag no longer exists.

    kedaman - FYI - Non-well formed HTML causes the UA to trigger "quirks mode" (otherwise known as tag soup, referring to the incorrectly nested tags) rendering. This has severe effects in Internet Explorer, where "standards mode" rendering is very much more faithful to the W3C standards than quirks mode (although that does not say much). This is more for historical reasons than anything.

    To use proper standards mode the page must include a valid doctype and be well formed HTML. Missing things like end </p> and </li> tags is acceptable (but not advisable) as that is valid in HTML 4.

  6. #6
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: is this valid HTML?

    You can check if your html is valid yourself by using W3C's very useful tool.

    http://validator.w3.org/

  7. #7

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: is this valid HTML?

    Thanks people, for all your help. In the example, the first item is displayed in red while the rest have the original colour, including the first bullet, which seems odd because all items are within the tags still. Does this "quirks mode" end all unclosed tags when an open tag that is not the inner most tag is closed, while ignoring close tags that are not inner most?
    john tindell: thanks for the link. An amazing amount of errors found in the page i refered to - 324. Btw, how come <BR /> is not valid html?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: is this valid HTML?

    Quirks mode behaviour is completely up to the browser. The rendering behaviour for invalid HTML is explicitly unspecified by the HTML standard. However, in valid HTML, a number of tags can be closed by other tags - e.g. <p>, <table>, <div> can close a preceding <p>. So it's likely that an opening <li> is closing a <font> tag that was opened within the previous <li> element.

    <BR /> is not valid HTML, <BR> is. The self-closing syntax is an XML feature, so it is not applicable in HTML. In SGML (HTML's base language), strictly, it should produce a line break plus a > sign, for whatever reason. But no UA does this.

    BTW, the more you go into the details of this stuff, the more you realise why it's impossible to practically apply a completely compliant SGML+HTML parser for documents on the web. Out of all pages on the web, probably only a relative handful are valid.

  9. #9

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Re: is this valid HTML?

    Ok, so Quirk mode isn't a pseudo html standard, but rather a browser's way of handling invalid html that is widely used anyway, and because of this people continue to use deprecated html code, which in turn means that browsers continue to support invalid html.. now what's the point with the standard? Are these quirk behaviours documented anywhere so you can tell how browsers will react to invalid html?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: is this valid HTML?

    Exactly. Now when proper XHTML (sent with an XML mime type, not text/html) becomes the widely used standard instead of HTML, people will not be able to get away with such dodgy code as it must be well formed XML. Until then, we are stuck with how it is now.

    As for documentation, try www.quirksmode.org - not sure how much of it actually refers to quirks mode, but still.

  11. #11
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: is this valid HTML?

    Quote Originally Posted by kedaman
    Btw, how come <BR /> is not valid html?
    it is valid in xhtml, as penagate said. since internet explorer (version 6) doesnt support the "application/xhtml+xml" mime-type, you can always just use the "text/html" mime-type for xhtml web pages (if they dont contain any xml code). and a reminder that all tags/attributes in xhtml are lowercase.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  12. #12
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: is this valid HTML?

    Can XML tags/attributes contain underscores?
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  13. #13
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: is this valid HTML?

    Quote Originally Posted by visualAd
    Can XML tags/attributes contain underscores?
    Strictly, but I would advise the use of dashes (-) instead.

    The standard is fairly terse, but if you're up for it:
    http://www.w3.org/TR/REC-xml/#sec-common-syn

    Quote Originally Posted by tr333
    you can always just use the "text/html" mime-type for xhtml web pages (if they dont contain any xml code).
    You may do that with XHTML 1.0 Transitional. You should not not do that with XHTML 1.0 Strict, or (especially) XHTML 1.1. The latter two must be served using an XML mime type (application/xhtml+xml, preferably, application/xml, or text/xml).

    http://www.w3.org/TR/xhtml-media-types/
    Last edited by penagate; Mar 24th, 2006 at 09:44 AM.

  14. #14
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: is this valid HTML?

    Quote Originally Posted by penagate
    You may do that with XHTML 1.0 Transitional. You should not not do that with XHTML 1.0 Strict, or (especially) XHTML 1.1. The latter two must be served using an XML mime type (application/xhtml+xml, preferably, application/xml, or text/xml).

    http://www.w3.org/TR/xhtml-media-types/
    does IE7 support the xhtml mime-type? without IE support, there isn't much point using it since most people won't be able to view an xhtml page.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  15. #15
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: is this valid HTML?

    Standards are great, but they need to be supported by the majority.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  16. #16
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: is this valid HTML?

    Quote Originally Posted by tr333
    does IE7 support the xhtml mime-type? without IE support, there isn't much point using it since most people won't be able to view an xhtml page.
    No. You should not serve XHTML in any flavour to IE, it is not supported.

    I use XHTML 1.1, but converted on the fly to HTML 4 for UAs that do not explicitly advertise their support for application/xhtml+xml.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width