Adding Comments to your HTML and CSS Code
Adding comments to your code can be a very useful tool that you may use. You may think you don’t need comments because you will always remember what you did, but what if you have 100+ pages? It can become a little hard to manage and remember why you did what you did. Comments are also useful for other coders looking at your source code. It may help them find out how you did something that they liked.
To put comments in the body area of your code you need to use <!– area you want commented starts here and end of commenting here–>. An example of this would look like:
Adding comments to CSS can be very useful in troubleshooting what lines of code are doing what. You can comment out a line, see the change it does and then un-comment it. It also lets you space out the areas of your CSS so if you use a linked style sheet you know what areas apply to what pages. To do a comment in CSS you would use /* comments here */. For example:
margin: 0 auto; /* Centers content in IE and FF */
background-color: Silver;
}


Leave a Reply