Document Structure Flashcards
What does <!DOCTYPE html>
declare in an HTML document?
It declares the document type and tells the browser to use standards mode.
What does the <html>
element represent in an HTML document?
The root element of the document.
What are the two primary sections of an HTML document?
The head (contains metadata) and the body (contains visible content).
What does the lang
attribute in the <html> tag specify?
What does the lang
attribute in the <html> tag specify?
What are the essential elements to include in every HTML document?
- Document type declaration.
- Content’s human language (lang attribute).
- Character set (charset attribute).
- Title of the application.
What is the role of the <meta charset="utf-8" />
tag?
It specifies the character encoding for the document, with UTF-8 being the standard.
What does the <title>
element define in an HTML document?
It defines the unique title of the page, which is displayed in the browser’s tab.
What is the purpose of the viewport <meta>
tag?
It helps ensure proper rendering and responsiveness on different devices by adjusting the page layout to fit screen sizes.
How should CSS be included in an HTML document?
CSS should be included using the <link>
tag to reference external stylesheets.
What does the defer attribute in a <script>
tag do?
It ensures that the script is executed after the page has finished rendering.
How do you include a favicon in the <head> section?
Use the <link rel="icon" href="path-to-icon" />
tag.
What is the purpose of HTML comments?
HTML comments are used to include notes in the code that are not displayed in the rendered page or parsed by the browser.