SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 37
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xhtml 1.0 strict

    Hi,

    I'm writing a page using xhtml 1.0 strict version. My question is about the first step when I create the file.

    Do I have to create a file with the name plus .html extension ? Or, I have to create the file with the name and .xhtml extension because I'm writing it in xhtml 1.0 strict.

    Thank you

  2. #2

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Basically it all comes down to what MIME type you associate with which extension and which MIME type you want to use to serve the file.

    XHTML is supposed to be served with a MIME type of application/xml+xhtml but may also be served with a MIME type of text/html. In the latter case it is treated as slightly malformed HTML 4 while in the former case Internet Explorer will offer the file for download instead of displaying it as IE doesn't understand that MIME type.

    You can configure your site to attach either MIME type to either extension.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stephen, hello, I'm Julio.
    From like a year ago I began to learn html, just the basics. Then I found a book about Internet Marketing and I decided to create a site to develop this activity. I chose as a niche "images and html", and I thought that I could teach people specifically how to insert images on pages.
    I haven't build my site yet, I have been writing content. But with the time I learnt that the last in html is xhtml 1.0 the strict version, so I changed my mind and instead of being "images and html", now for me is better to move toward "images and xhtml"
    So what I think to do in the near future is create my site and to learn xhtml 1.0 strict version and at the same time to teach in my site what I'm learning.
    My question for you is Does this make sense for you ? I mean can a person like me to learn and then teach to others How to insert images on web pages using xhtml 1.0 ?
    Can I learn xhtml code and skip the step of learning html ?
    Can I begin learning xhtml without having passed first through html?
    My best regards,
    Julio

  5. #5
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    HTML and XHTML(served as text/html (the only viable way to serve it) since Internet Explorer does not support XHTML) is the same thing.

    The only difference in the actual markup is XHTML requires you to write the markup in lowercase, close each element: <p> </p>, <li> </i> (some are self closing) <img ... />, <br />, that you enclose all attribute values in quotes href="http://yourdomain.com/" and certain elements/attributes have been deprecated: <font>, <center> target="blank" for example. There are a few more things but I will not get into it now.

    Though you can/should do all of this in HTML also and it will still be valid.

    So if you learn XHTML, you are also learning HTML and vice versa, the only real advantage of using XHTML at this point is so that from teh start you learn to write clean, valid markup as opposed to the tag soup that HTML will still allow you to use. Though you should not be using anyway.
    Last edited by RetroNetro; Jul 9, 2009 at 19:08. Reason: Fixed grammar, I think ;)

  6. #6
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The latest version of (x)HTML suitable for use on the web is HTML 4.01 strict. Internet Explorer doesn't support XHTML so if you want to support visitors using IE you need to use HTML instead of XHTML.

    I have a simple XHTML 1.0 strict page at http://www.felgall.com/realxhtml.php that contains just one paragraph of content - just sufficient to show how somet browsers handle XHTML differently from the way they handle HTML.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  7. #7
    SitePoint Zealot
    Join Date
    Mar 2008
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Per Ian Hixie -- GOOGLE guru and father of HTML 5:

    Sending XHTML as text/html considered harmful

    In accordance with Mr. Hixie's current recommendation I am now using HTML 5 (just a little tongue-in-cheek here).

    James
    Last edited by jamesicus; Jul 10, 2009 at 08:35. Reason: corrected spelling

  8. #8
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BPartch View Post
    HTML and XHTML(served as text/html (the only viable way to serve it) since Internet Explorer does not support XHTML) is the same thing.
    Although I know what you mean, it's a dangerous way to state things. It might confuse beginners who believe that XHTML is a type of HTML, which it most definitely is not.

    Quote Originally Posted by BPartch View Post
    The only difference in the actual markup is XHTML requires you to write the markup in lowercase, close each element: <p> </p>, <li> </i> (some are self closing) <img ... />, <br />, that you enclose all attribute values in quotes href="http://yourdomain.com/"
    If you serve it as text/html you don't even have to do that. Since you're really using HTML, browsers will parse it as HTML and, due to parser bugs, will ignore the NET syntax ('/>'). A validator would complain if you use uppercase tags or write <br> instead of <br/>, but browsers won't care as long as you serve it as HTML.

    Quote Originally Posted by BPartch View Post
    and certain elements/attributes have been deprecated: <font>, <center> target="blank" for example.
    This has nothing to do with XHTML vs HTML. Those element types and attributes are deprecated in HTML 4.01 Strict as well. They are also valid in XHTML 1.0 Transitional and XHTML 1.0 Frameset.

    Quote Originally Posted by BPartch View Post
    Though you can/should do all of this in HTML also and it will still be valid.
    Not quite. The NET syntax will cause invalid HTML if you use it for, e.g., <link> or <meta> elements. It also means something quite different in HTML when you write <br/>, even though no browser treats that correctly.

    Quote Originally Posted by BPartch View Post
    So if you learn XHTML, you are also learning HTML and vice versa, the only real advantage of using XHTML at this point is so that from teh start you learn to write clean, valid markup as opposed to the tag soup that HTML will still allow you to use.
    HTML does not allow tag soup any more than XHTML does, and you can write tag soup with perfectly valid XHTML as well. The XML syntax is slightly more consistent than the HTML syntax, but it's not any more strict. Both languages can be parsed unambiguously as long as the markup is valid.
    Birnam wood is come to Dunsinane

  9. #9
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I was afraid of this.
    Quote Originally Posted by AutisticCuckoo View Post
    Although I know what you mean, it's a dangerous way to state things. It might confuse beginners who believe that XHTML is a type of HTML, which it most definitely is not.


    If you serve it as text/html you don't even have to do that. Since you're really using HTML, browsers will parse it as HTML and, due to parser bugs, will ignore the NET syntax ('/>'). A validator would complain if you use uppercase tags or write <br> instead of <br/>, but browsers won't care as long as you serve it as HTML.


    This has nothing to do with XHTML vs HTML. Those element types and attributes are deprecated in HTML 4.01 Strict as well. They are also valid in XHTML 1.0 Transitional and XHTML 1.0 Frameset.


    Not quite. The NET syntax will cause invalid HTML if you use it for, e.g., <link> or <meta> elements. It also means something quite different in HTML when you write <br/>, even though no browser treats that correctly.


    HTML does not allow tag soup any more than XHTML does, and you can write tag soup with perfectly valid XHTML as well. The XML syntax is slightly more consistent than the HTML syntax, but it's not any more strict. Both languages can be parsed unambiguously as long as the markup is valid.

  10. #10
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BPartch View Post
    I was afraid of this.
    <pratchett>
    COWER MORTALS!
    </pratchett>

    Birnam wood is come to Dunsinane

  11. #11
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Although I know what you mean, it's a dangerous way to state things. It might confuse beginners who believe that XHTML is a type of HTML, which it most definitely is not.
    Yes that was quite a sentence I crafted there.
    Quote Originally Posted by AutisticCuckoo View Post
    If you serve it as text/html you don't even have to do that. Since you're really using HTML, browsers will parse it as HTML and, due to parser bugs, will ignore the NET syntax ('/>'). A validator would complain if you use uppercase tags or write <br> instead of <br/>, but browsers won't care as long as you serve it as HTML.
    Yes I was thinking more of SGML parsers when I made this statement.
    Quote Originally Posted by AutisticCuckoo View Post
    This has nothing to do with XHTML vs HTML. Those element types and attributes are deprecated in HTML 4.01 Strict as well. They are also valid in XHTML 1.0 Transitional and XHTML 1.0 Frameset.
    Indeed, I never use any of them so I forgot this
    Quote Originally Posted by AutisticCuckoo View Post
    Not quite. The NET syntax will cause invalid HTML if you use it for, e.g., <link> or <meta> elements.
    I was thinking more about elements within the <body>.
    Quote Originally Posted by AutisticCuckoo View Post
    It also means something quite different in HTML when you write <br/>, even though no browser treats that correctly.
    Quote Originally Posted by AutisticCuckoo View Post
    HTML does not allow tag soup any more than XHTML does, and you can write tag soup with perfectly valid XHTML as well. The XML syntax is slightly more consistent than the HTML syntax, but it's not any more strict. Both languages can be parsed unambiguously as long as the markup is valid.
    I've got no thinly veiled excuse for these 2.

  12. #12
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by BPartch View Post
    I was thinking more about elements within the <body>.
    <img/>
    <br/>
    <hr/>
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  13. #13
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using,
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"....+link >
    as my DTD in a html file.
    I need to make a line break
    What is the most correct tag <br /> or <br>

  14. #14
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    <img/>
    <br/>
    <hr/>
    I stand corrected. I just tested and in fact those do cause a warning with the ('/>') in HTML 4.01.

    I fell for the hype when I first started learning and have been using (x)HTML for the majority of the time I've been doing it. It seems like I knew these things at one time, I guess my lack of using HTML 4.01 with any regularity has lead to my forgetting this stuff and getting my facts confused.

    I think I've got it sorted better now though.
    Quote Originally Posted by julioa View Post
    I'm using,
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"....+link >
    as my DTD in a html file.
    I need to make a line break
    What is the most correct tag <br /> or <br>
    Code HTML4Strict:
    <br>

  15. #15
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by julioa View Post
    I'm using,
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"....+link >
    as my DTD in a html file.
    I need to make a line break
    What is the most correct tag <br /> or <br>
    <br>

  16. #16
    SitePoint Wizard silver trophybronze trophy
    Join Date
    Jul 2008
    Location
    New York, NY
    Posts
    1,432
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @BPartch - You beat me to the post

  17. #17
    Is Still Alive silver trophybronze trophy RetroNetro's Avatar
    Join Date
    Jul 2003
    Location
    Texas
    Posts
    6,883
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cooper.semantics View Post
    @BPartch - You beat me to the post
    Well I just learned something new(again) and was eager.

  18. #18
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    But Julio, always ask yourself WHY you need the break.

    In well-written pages, you will find very few <br>s (or <br />s in XHTML doctypes). <br> is a content break, so you take a moment to determine if the break is indeed actually part of the content. Most common examples are postal addresses and poetry. I've seen them defended in forms as well.

  19. #19
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    It also means something quite different in HTML when you write <br/>, even though no browser treats that correctly.
    It's a shame that not even Amaya supports SHORTTAG. At least Internet Explorer 8 correctly close an open <p> when it encounters another block-level element, unlike Internet Explorer 7 and below.

    I'm still waiting for a browser to correctly render e.g.
    Code html4strict:
    <p<em/Paragraph/ with the first word emphasised.
    <>Another paragraph.
    <ul<li>List item.
    <>Another list item</></>
    <p>Another paragraph.
    <>Another paragraph.</>
    (Not even Sitepoint's code highlighter interprets it correctly - perhaps something you'll want to look into, Tommy?
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  20. #20
    Resident curmudgeon bronze trophy gary.turner's Avatar
    Join Date
    Jan 2009
    Location
    Dallas
    Posts
    990
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    Most common examples are postal addresses and poetry.
    Since the structure of the verse is so important to metrical compositions, poetry is best marked up as preformatted content, <pre>. See Poetry & Verse in the HTML Page.

    Likewise, I have begun using the <pre> element for addresses because the common formatting conventions make it a structural issue. I'm not totally wedded to it yet.

    A usage I have found for <br> is in menus where I want multi-worded items to use multiple lines. By the same token, I use &#38;nbsp; for when I don't want multi-word items to break.

    cheers,

    gary
    Anyone can build a usable website. It takes a graphic
    designer to make it slow, confusing, and painful to use.

    Simple minded html & css demos and tutorials

  21. #21
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by C. Ankerstjerne View Post
    It's a shame that not even Amaya supports SHORTTAG.
    I haven't looked at Amaya in ages, but wasn't it supposed to be XHTML-only? In that case there's no need to support short tags, because the XML doesn't support short tags.

    Quote Originally Posted by C. Ankerstjerne View Post
    (Not even Sitepoint's code highlighter interprets it correctly - perhaps something you'll want to look into, Tommy?
    I'm just a volunteer moderator. I don't have access to the forum code base or the SitePoint extensions. Anyway, I don't think it really matters. Since no mainstream browser supports short tags, they're unusable in the real world.
    Birnam wood is come to Dunsinane

  22. #22
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    The W3C website mentions Amaya being both HTML and XHTML, though they're not too specific about it. I have never really taken an interest in Amaya - last time I looked, I wasn't impressed. Just though they'd want to support their own standards.

    As for the code highlighting, I do like to bring up the SHORTTAG syntax, as it really is a pretty clever invention, which died a sudden death.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  23. #23
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Gary
    Likewise, I have begun using the <pre> element for addresses because the common formatting conventions make it a structural issue. I'm not totally wedded to it yet.
    I've tried that (pre), when I had a contact page with a floated dd holding an address. It didn't work as nicely as nesting a p inside with br's, but it's something I planned to try for just an address sitting loosely in a page.

    A usage I have found for <br> is in menus where I want multi-worded items to use multiple lines. By the same token, I use &nbsp; for when I don't want multi-word items to break.
    I've been using spans for both of those, mostly because the wrapping in my cases were aesthetic and unstyled text made sense in pure HTML. I haven't used &nbsp anywhere tho I was tempted once for an IE table bug : (

  24. #24
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    But Julio, always ask yourself WHY you need the break.
    No, I just needed to use a <br> to se parate an image from a paragraph.

    <body>
    <p>
    Between this two tags you write the page content. Here you can write a paragraph like this one. Or you can insert here an image like the following that shows my favorite corner in my house. <br> <img src="myoffice.JPG" alt="My favorite corner in my house">
    </p>
    </body>

    Or there is another way to do it ?
    Sorry my lack of knowledge, Julio

  25. #25
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by C. Ankerstjerne View Post
    As for the code highlighting, I do like to bring up the SHORTTAG syntax, as it really is a pretty clever invention, which died a sudden death.
    Stillborn would be a more appropriate word in this case.

    Quote Originally Posted by julioa View Post
    Or there is another way to do it ?
    Code CSS:
    p img {display:block}
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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