BashChelik Posted January 9, 2010 Share Posted January 9, 2010 Hello fellow web designers!!!When writing comment like this: <!--Comment goes here--> Are those 2 slashes before and after the text "Comment goes here", part of the tag or part of the comment?I tried inserting comment without slashes and they remain hidden. Best of luck,Mirko Link to comment Share on other sites More sharing options...
thescientist Posted January 9, 2010 Share Posted January 9, 2010 i thought it was part of the tag<!-- (comment) --> Link to comment Share on other sites More sharing options...
Ingolme Posted January 9, 2010 Share Posted January 9, 2010 To do it properly, you have to put a space after the two hyphens and another space befor the closing tag: <!--[space]Some text[space]--> Otherwise, some browsers may not close the comment. Link to comment Share on other sites More sharing options...
BashChelik Posted January 9, 2010 Author Share Posted January 9, 2010 Thank you for clarifying it to me.If u ask me, that is just complicating things that could be made simpler.I mean, why use the slashes and space if it could be clearer without it.It's not like <!Comment> is reserved or something, as i know. Best of luck,Mirko Link to comment Share on other sites More sharing options...
Synook Posted January 10, 2010 Share Posted January 10, 2010 The <! sequence is actually the markup declaration open delimiter, and only -- denotes the actual comment open delimiter. There are other markup declarations you can make, such as special character blocks like CDATA (<![CDATA[ ... ]]>).http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4. Link to comment Share on other sites More sharing options...
BashChelik Posted January 10, 2010 Author Share Posted January 10, 2010 From the link Synook gave me: White space is not permitted between the markup declaration open delimiter("<!") and the comment open delimiter ("--"), but is permitted between the comment close delimiter ("--") and the markup declaration close delimiter (">").So ,is it OK if i put space between closing hyphens and closing angle brackets, like this?<!-- Comment -- >And between, are u sure u have to insert space after and before hyphens, because it is not mentioned anywhere?Best of luck,Mirko Link to comment Share on other sites More sharing options...
Synook Posted January 10, 2010 Share Posted January 10, 2010 Officially, you don't have to place spaces after the comment delimiter, however Ingolme is saying that regardless of specification some browsers may not understand properly if there aren't spaces. And yes, apparently you can have a space in between the closing -- and >. Try it out! Link to comment Share on other sites More sharing options...
skaterdav85 Posted January 11, 2010 Share Posted January 11, 2010 How come comments are not allowed before the DOCTYPE tag? I had this one comment which made IE misinterpret my stylesheet and thus my page looked terrible. It took me forever to figure out it was the comment. Anyone know why? Link to comment Share on other sites More sharing options...
Synook Posted January 11, 2010 Share Posted January 11, 2010 Comments should be able to come before the DOCTYPE[1] (interestingly enough, if you look at the syntax, the DOCTYPE is another type of markup declaration). Are you sure there wasn't a syntax error? Link to comment Share on other sites More sharing options...
skaterdav85 Posted January 11, 2010 Share Posted January 11, 2010 I'm pretty sure. this was my comment: <!-- Begining of HTML page ********************************************************************************************************************************************* --> Link to comment Share on other sites More sharing options...
thescientist Posted January 11, 2010 Share Posted January 11, 2010 hmm, that seems like it should work. What text editor do you use? With context it will turn comments green, but it doesn't turn the rest of my code on a test page I made green, so one would assume its OK to do that... Link to comment Share on other sites More sharing options...
boen_robot Posted January 11, 2010 Share Posted January 11, 2010 Big Dave, just remove the comment... why keep it anyway?IE is hard coded to turn on strict mode on only for DTDs and DTDs + xml prolog. It doesn't switch when you have comments in between. Yes, the spec allows it, but IE is quirky in this regard. Link to comment Share on other sites More sharing options...
thescientist Posted January 11, 2010 Share Posted January 11, 2010 actually, now that boen_robot brings up the IE bug, I had an issue with putting comments in front of the DTD once. Anyway, the DTD in and of itself is the declaration of the start of an HTML document, so it's really the same as saying <!-- ************ HTML Page ************ --> albeit just a bit more technical. And if you must need/want it in there, just put it after the DTD. Link to comment Share on other sites More sharing options...
skaterdav85 Posted January 11, 2010 Share Posted January 11, 2010 Ya i just removed it. I put it there because I wanted to separate my php code up top from the bulk of my html. Took me awhile to figure out it was the comment. My stylesheet wasnt being interpretted right, nor was any of my JS or JS libraries. What a pain that was! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.