Curso de HTML Completo: Aula 06 - Comentários
Summary
TLDRIn this tutorial, the instructor explains the use of HTML comments, a crucial tool for web developers. The video demonstrates how to insert comments in code to make it more organized and easier to navigate. It covers how comments are ignored by the browser, and how they can help document sections of code for clarity, especially in complex structures like divs. The tutorial also shows how to temporarily disable parts of the code without deleting them and highlights shortcuts in Visual Studio Code to comment code more efficiently. The lesson concludes with encouragement to continue exploring the course content.
Takeaways
- 😀 Comments in HTML are used to add non-displayed text that helps developers understand the code.
- 😀 Comments are written between `<!--` and `-->`, and anything between them will not be rendered by the browser.
- 😀 Developers can use comments to describe sections of their code, making it easier to navigate and maintain later.
- 😀 Comments can be helpful when working with complex code structures, such as nested `div` elements.
- 😀 It is a good practice to comment your code, especially for future reference or collaboration with other developers.
- 😀 You can comment out sections of code that you might want to use later without deleting them.
- 😀 An example of commenting out a paragraph element: `<!-- This is a paragraph -->`.
- 😀 In Visual Studio Code (VS Code), there is a keyboard shortcut (`Ctrl + /` or `Cmd + /`) to quickly comment and uncomment lines of code.
- 😀 If you want to deactivate a part of your code temporarily, you can wrap it in comment tags instead of deleting it.
- 😀 The use of comments also helps to remember parts of code that may need to be modified or fixed later.
- 😀 At the end of the tutorial, viewers are encouraged to like, subscribe, and continue watching more lessons.
Q & A
What is the purpose of using comments in HTML?
-The purpose of using comments in HTML is to add explanatory notes within the code that the browser will ignore. These comments help developers understand and organize their code better, making it easier to maintain and debug.
How do you create a comment in HTML?
-In HTML, a comment is created by placing the text between the opening tag <!-- and the closing tag -->. Anything within these tags is considered a comment and will not be displayed in the browser.
What is the function of the 'exclamation mark' in HTML comments?
-The exclamation mark at the beginning of a comment (<!--) indicates the start of the comment in HTML. It helps distinguish the comment from regular HTML tags.
Can you give an example of how to comment on a paragraph in HTML?
-Sure! To comment on a paragraph, you would write: <!-- This is a comment about the paragraph -->. This comment will not be displayed in the browser but serves as a note for developers.
How can comments help when working with complex code or multiple divs?
-When working with complex code or multiple divs, comments can help you keep track of different sections of your code. For example, you could comment on the start and end of each div to clearly understand the structure of the page.
What is a practical scenario where comments could help during development?
-Comments can be used when a developer temporarily disables a piece of code, such as a paragraph or a section, by commenting it out. This allows the developer to test other parts of the code without permanently deleting the commented-out sections.
What happens when you comment out a piece of HTML code?
-When you comment out a piece of HTML code, that section of code is ignored by the browser. It will not be rendered or displayed on the webpage, but it remains in the source code for future reference or reactivation.
What shortcut is used in VS Code to comment out code?
-In Visual Studio Code (VS Code), you can use the keyboard shortcut Ctrl + / (or Command + / on macOS) to comment out the selected code. This allows you to quickly toggle comments without manually typing the opening and closing comment tags.
What are some best practices for using comments in HTML code?
-Best practices include using comments to explain complex code sections, marking the beginning and end of major code blocks like divs, and commenting out code that you don't want to execute temporarily. It's also important to avoid over-commenting or stating the obvious.
Can comments in HTML be used for code organization, and if so, how?
-Yes, comments in HTML can significantly aid in code organization. For example, when working with nested divs or complex layouts, developers can use comments to label different sections, making it easier to navigate the code and understand its structure.
Outlines

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowMindmap

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowKeywords

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowHighlights

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowTranscripts

This section is available to paid users only. Please upgrade to access this part.
Upgrade NowBrowse More Related Video

Formatting style and Global attributes | Hindi

HTML Tutorial #4: Images & File Paths | Web Development | Filipino | Tagalog

HTML Tutorial #6: List | Web Development | Filipino | Tagalog

HTML Tag Text Basics | HTML5 Element Text Tutorial

Belajar HTML Untuk Pemula: Membuat Komentar Pada HTML

#8 كورس html كامل بالعربي | التعليقات comments
5.0 / 5 (0 votes)