Welcome Guest ( Log In | Register )



2 Pages V  < 1 2  
Reply to this topicStart new topic
> Good Comments Make Good Html., Commenting makes HTML easier to write.
twitch
post Oct 29 2005, 07:04 PM
Post #11


Veteran Nut
Group Icon

Group: Members
Posts: 527
Joined: 4-October 05
From: UK
Member No.: 8,895



Although a lot of people are against validation, it makes us better at designing. By validating your website and routing out all of the errors, we can make better and more usable sites. Something that XML/XHTML was developed for.

Vujsa, this is a very good thread. However, I believe you failed to mention WHY we put the contents of a script in comment tags. The answer is that older browsers (IE 3.0) may not be able to perform the actions of the script, and would display it as text. By putting it in comment tags, it is kept from displaying, but the browser still reads and processors the script.
Go to the top of the page
 
+Quote Post
vizskywalker
post Oct 30 2005, 09:25 PM
Post #12


Techno-Necromancer
Group Icon

Group: Members
Posts: 1,018
Joined: 13-January 05
From: The Net
Member No.: 2,127



Also, if you are using XHTML, be sure to read the documentation on how to do comments. In XHTML 1.0 Strict, putting HTML comments around code inside javascript tags is invalid, and will cause lack of validation. Instead, you need to use the CDATA comments.

~Viz
Go to the top of the page
 
+Quote Post
Quatrux
post Oct 30 2005, 10:47 PM
Post #13


the Q
Group Icon

Group: [HOSTED]
Posts: 1,013
Joined: 13-July 05
From: Lithuania, Vilnius
Member No.: 7,059



I almost never use comments in html unless i want to make a comment for myself.. the output php shows me as html is usually different and stuff, i never watch it, only to make valid and clean in the making period, and later when everything runs smooth i never watch the source.. maybe it is due to my html is never being very complicated, i just see it with my eyes as a web browser biggrin.gif but comments due help, even if it is said: "a real programmer does not need comments, the code is obvious to him" but sometimes the codes i wrote say a year back is not so understandable, that is why I started to write comments and another reason is because i might work with other people who will edit/write it too.
Go to the top of the page
 
+Quote Post
Logan Deathbring...
post Oct 31 2005, 03:17 AM
Post #14


Geek in-training
Group Icon

Group: Members
Posts: 301
Joined: 2-July 05
From: Washington State, USA, 3rd Rock from the Star Sol
Member No.: 6,772



Although I don't comment my HTML like I should, and must admit that I pay the price later on...lol. Anyone who is just starting out should comment their HTML and any scripting/programing they do. As stated by Vujsa and others this helps with revisions later on, ALSO it helps when giving a friend a copy to look over when you need help troubleshooting a page or whatever so that they can tell at a glance what you were trying to do in a certin section without haveing to pull out a 5 lb. 4 ring binder full of coding notes to track down some obscure and rarely used, by the troubleshooter, bit of code tongue.gif
Go to the top of the page
 
+Quote Post
twitch
post Oct 31 2005, 04:40 AM
Post #15


Veteran Nut
Group Icon

Group: Members
Posts: 527
Joined: 4-October 05
From: UK
Member No.: 8,895



QUOTE(guy @ Oct 29 2005, 07:04 PM)
Although a lot of people are against validation, it makes us better at designing. By validating your website and routing out all of the errors, we can make better and more usable sites. Something that XML/XHTML was developed for.

Vujsa, this is a very good thread. However, I believe you failed to mention WHY we put the contents of a script in comment tags. The answer is that older browsers (IE 3.0) may not be able to perform the actions of the script, and would display it as text. By putting it in comment tags, it is kept from displaying, but the browser still reads and processors the script.
*


Sorry vujsa, I failed to see that you did explain, in brief, why comment tags are used in <script> tags.
Go to the top of the page
 
+Quote Post
minnieadkins
post Oct 31 2005, 06:48 PM
Post #16


Premium Member
Group Icon

Group: Members
Posts: 292
Joined: 15-December 04
Member No.: 1,768



Comments make the code. HTML comments aren't very widely used, but they do help, especially if you plan on modifying your layout in the future. It's also a good practice to comment the end of your functions (php, c++, java, etc) and the beginning to display what they actually do. While loops, foreach loops, if statements all pose a threat of error. All it takes is overlooking that one little '}' and there you have it. ERROR. Good advice on the comments, although I personally think you can have too many comments. Keep it informative and direct. Don't make half your document comments. =/

For a nice free text editor, I recommend HTMLKit from Chami. When you put in your javascript it automatically puts in the comment to keep older browsers from reading your script. It's a very nice editor, and very customizable. Lots of plugins for php as well. I recently used notepad++ and it's pretty good for all kinds of languages, and you can minimize your blocks effectively.
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. HTML 101 - Web Design For Beginners(7)
  2. Quick Html!(3)
  3. HTML Tags(4)
  4. Html Basic Tutorial(8)


 



- Lo-Fi Version Time is now: 22nd August 2008 - 02:11 AM