Part 6: Code Documentation & Visual Separators
Senior Full-Stack Developer
<!-- and end with -->Mark the beginning and end of major sections
Explain complex or non-obvious code
Comment out code for testing or future use
The <hr> tag creates a horizontal rule (line) that separates content.
Content above the line
Content below the line
The <hr> tag is an empty element - it doesn't require a closing tag.
While these attributes are deprecated in HTML5, they're often handled with CSS now:
In modern web development, we style <hr> elements using CSS instead of deprecated attributes:
Organizing large HTML files
Communicating with other developers
Using HR for visual organization
This is the introduction to our article...
Here are the key points we want to discuss...
In summary, we've learned that...
Troubleshooting code issues
Screen Readers: While comments are ignored by screen readers, <hr> elements are announced as "separator" which can help users understand content structure.
Write comments that are easy to understand
Focus on the purpose behind code decisions
Update comments when code changes
Only comment when it adds real value
Use horizontal rules consistently for similar content separations
Use CSS instead of deprecated HR attributes
Mark major sections of your document
Comment non-obvious code sections
Separate distinct content sections
Create visually appealing separators
Avoid comments that state the obvious
Remove or update irrelevant comments
Don't use HR for minor spacing
Avoid width, size, color on HR tags
You've Learned HTML Comments & Horizontal Rules
Code documentation with <!-- -->
Section markers, explanations, TODOs
Visual separators with <hr>
Modern CSS vs deprecated attributes
When and how to use comments & HR
Effective usage guidelines
Build an HTML page with proper comments and horizontal rules:
Users don't see them, but developers benefit greatly
Well-commented code is easier to maintain
HR elements improve content readability
Use CSS for styling, not deprecated attributes
Next: Learn about creating hyperlinks, anchor tags, and website navigation
What are HTML Comments?
HTML comments are notes within your code that are not displayed in the browser but help developers understand the code.
<div class="header">
<h1>My Website</h1>
</div>
<!-- End of header section -->
Comment Syntax:
Why Use Comments?
Code Documentation
Explain complex sections of code
Temporary Code Removal
Disable code without deleting it
Team Collaboration
Help other developers understand your code
Debugging
Isolate problematic code sections
Future Reference
Remember why you made certain decisions
Section Organization
Mark different parts of your document