Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: XHTML comments

  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts

    XHTML comments

    Hi!

    When I try to comment more lines out like below:

    Code:
    <!--................................
    ...RIGHT SIDE BOXES END......
    ...................................-->
    I get an error in the W3C validator. How do I then comment more lines out?

  • #2
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    Try this: It should work.

    Code:
    <!--
    
    RIGHT SIDE BOXES END
    
    -->
    .
    .

  • #3
    Regular Coder Jutlander's Avatar
    Join Date
    Jun 2007
    Location
    In my own sick little world :P
    Posts
    425
    Thanks
    1
    Thanked 12 Times in 12 Posts
    I believe the reason yours isn't working is because there must be a space after the starting tag and before the closing tag.
    .
    .

  • #4
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    @Jutlander: Det er fordi, at jeg gerne vil have nogle tegn imellem lukke- og åbne tagsene, så det bliver mere overskueligt. (Sorry, I couldn't in English..)

    And I have tried with space between the closing and opening tag, no difference.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Got link?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    It would be helpful if we could see the entirety of the code and/or the actual error message.

    One issue that I can think of is when you place a comment as the sole content of an element that must have a child element (e.g., the body element under a Strict DTD).

    Another is if you have an XML (XHTML) document and the comment contains the character sequence “--”. Placing two Hyphen‐Minus (-) characters adjacent to one another within comment tags is illegal in XML.

    Code:
    <!------ illegal XML comment ------>
    <!-- illegal -- XML and SGML (HTML) comment -->
    If using HTML, there needs to be an even number of comment delimiters (--) and the comment text needs to occur after every odd delimiter.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #7
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Hi guys.

    It works if I just have one line like this, but that's just a single line:

    Code:
    <!-- COMMENT -->
    @ Arbitrator: Yes, you are right. It's illegal to put more than the 2 opening and closing "--"s in the comment.

    Here ya are, the link (just view source): http://www.xflightx.port10.com/test/main-layout.php

    I KNOW that I have used "--"s which is illegal, but it dosn't work with "...."s and "###"s either.

  • #8
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by CaptainB View Post
    I KNOW that I have used "--"s which is illegal, but it dosn't work with "...."s and "###"s either.
    You’re going to have to fix this problem for all of the comments. I suspect that the errors will go away once you do that.

    To make things clearer, know that the boundary of a comment is, technically, not defined by <!-- and -->. It’s defined by -- and --.

    Code:
    <!---- comment --><div></div><!------>
    In the above code, everything in green is commented out and everything in red is in an illegal position. Thus, it’s possible that errors in one comment may cause errors in subsequent comments since two comments may not be as separate as they appear.

    You might want to also remove the comment above the document type declaration since that puts Internet Explorer in quirks mode. Firefox seems to be in quirks mode as well. Oddly, you have a lot of markup commented out, but Firefox is showing it anyway; I suspect that quirks mode is the reason for that. Internet Explorer has never handled SGML comments correctly, so I wouldn’t expect any issues there.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #9
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Ok, I have now replaced all the illegal "--"s in the comments, and removed the comment in top of the page. However it didn't change anything here (IE6).

    Oh, and thanks for the explanation of the comment "lines".

  • #10
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by CaptainB View Post
    Ok, I have now replaced all the illegal "--"s in the comments, and removed the comment in top of the page.
    You have one validation error remaining: you forgot the end tag for an h2 element.

    Edit: I made a slight mistake before. You don’t have a missing h2 tag. You have a form element inside of an h2 element. That’s illegal in HTML/XHTML.

    Quote Originally Posted by CaptainB View Post
    However it didn't change anything here (IE6).
    The rendering of Internet Explorer 6 looks fine from here.

    Firefox is out of quirks mode and looks better than it did before. However, the right column wraps to below the content column and my Firefox Adblock extension is blocking the image named banner.gif.
    Last edited by Arbitrator; 07-07-2007 at 06:42 PM. Reason: See the post.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #11
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Lol...It also looks fine for me now - dono what happened.
    However I have now decided, how strange it may sound, to stick with the original comments...Anyways, Do u guys also see the "3" number near the bottom of the site?

    Oh, and does the blocker still block the banner?
    Last edited by CaptainB; 07-07-2007 at 05:51 PM.

  • #12
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,302
    Thanks
    28
    Thanked 276 Times in 270 Posts
    Quote Originally Posted by CaptainB View Post
    .Anyways, Do u guys also see the "3" number near the bottom of the site?
    If you mean, “Total votes: 3”, then, yes, I see it.

    Quote Originally Posted by CaptainB View Post
    Oh, and does the blocker still block the banner?
    I see the banner now. Personally, I wouldn’t use the word banner at all though, since there may be stricter ad‐blockers out there. The terms “logo”, “head”, “header”, “heading”, “masthead”, “branding”, etc. are all possible alternatives.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #13
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    No, not that. See this screenshot:




    And thanks for the tips with the banner text - I see what you mean.

    And just one more question: How would I get the footer to align completely with the bottom line? I have tried to apply following to the div, but without any effect:

    vertical-align:bottom
    and
    margin-bottom:0px;

  • #14
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    That duplicate character is caused by...wait for it...the use of to many html comments in between floats.

    http://www.positioniseverything.net/...haracters.html

    Also I notice you are using IE6. You do realize that this is the root of all of your problems? Code for a good browser like Firefox and tweak for IE. I can't test on IE6 unless I install a virtual machine on Vista which I haven't done yet.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #15
    Regular Coder
    Join Date
    Jun 2007
    Posts
    805
    Thanks
    123
    Thanked 23 Times in 23 Posts
    Thanks for the link, interesting!

    However if I use the -3 margin trick it works, but my layout gets messed up. I also tried with the "<!--[if !IE]>Put your commentary in here...<![endif]-->", however I can't figure out if I should use it for all the comments or not? I tried to use it with the last 2 (sandwich) comments, but that didn't work out..?
    Last edited by CaptainB; 07-07-2007 at 08:04 PM.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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