HTML Questions Flashcards
What is the relationship between HTTP and HTML?
HTTP (Hypertext Transfer Protocol) and HTML (Hypertext Markup Language) are both fundamental components of the World Wide Web. HTML is used to structure and present content on web pages, while HTTP is the protocol used for communication between web servers and web browsers. When you visit a website, your browser sends HTTP requests to the server, which responds with HTML code that the browser then interprets and displays as a web page.
How does our computer understand the HTML codes we write in code editors?
Computers understand HTML codes because web browsers, such as Chrome or Firefox, are designed to interpret and render HTML documents. Browsers read the HTML tags and elements in the code and use them to determine the structure and formatting of the content. They then display the content accordingly, applying styles, rendering images, and executing any scripts embedded in the HTML.
Is HTTP protocol involved when we search for files locally (in our computer)?
No, the HTTP protocol is not involved when you search for files locally on your computer. The HTTP protocol is specifically used for communication between web browsers and web servers over the internet. When you search for files on your computer, the operating system and file system handle the search operation locally without the need for any network communication.
Why do we get error message “ 404 Page Not Found”?
The “404 Page Not Found” error message indicates that the web server could not find the requested resource or webpage. It typically occurs when you try to access a URL that doesn’t exist or has been removed. The server responds with the 404 status code to inform the browser that the requested page cannot be found.
Is everything the browser displays HTML?
Not everything displayed in a web browser is HTML. While HTML is responsible for structuring the main content of a web page, other web technologies like CSS (Cascading Style Sheets) and JavaScript can be used to enhance the appearance and functionality of the page. CSS is used for styling and layout, while JavaScript allows for dynamic interactions and behavior.
Why do we need a folder when we can simply create an HTML file on VSC and see our HTML in browser?
Folders are used to organize and manage files in a structured manner. When working on web development projects, having a folder structure helps keep related files together, such as HTML, CSS, and JavaScript files. It also makes it easier to navigate and locate specific files within the project. While you can create an HTML file directly in a code editor like Visual Studio Code (VSC), it is still beneficial to organize your files within folders for better project management.
Can the format feature on VSC correct our codes if we forget opening or closing tags?
Visual Studio Code’s format feature can help improve the readability and consistency of your code by automatically formatting it according to predefined rules. While it can help with indentation and spacing, it won’t correct missing or mismatched opening/closing tags. It’s important to ensure proper tag structure manually to avoid issues with the interpretation of your HTML code.
When we have an existing VSC window running, can we open a new VSC window?
Yes, you can open multiple instances of Visual Studio Code simultaneously. You can either open a new window from the File menu or by using keyboard shortcuts (e.g., Ctrl+Shift+N on Windows or Command+Shift+N on macOS). Each VSC window operates independently, allowing you to work on different projects or files simultaneously.
Does including space or a new line affect our HTML codes?
In general, spaces and new lines within HTML code do not affect how the web browser interprets and displays the content. HTML ignores extra spaces and new lines and collapses them into a single space. However, there are exceptions where spaces and new lines can impact the visual layout, such as when using the <pre>
tag, which preserves whitespace formatting.
How come the header tag in our HTML shows as bold when viewed in browser without applying any CSS?
By default, web browsers apply some basic styling to HTML elements, even without any additional CSS. The <header>
tag is one of the semantic elements in HTML, and certain browsers may apply a default style to make it visually distinct, such as displaying it in bold. However, the specific default styles can vary between browsers, and it’s generally recommended to define your own styles using CSS to ensure consistent appearance across different platforms.
Why don’t certain HTML tags, such as, img or br tags need closing tags?
Certain HTML tags, such as <img>
(for images) and <br>
(for line breaks), are classified as self-closing or void elements. These elements don’t require explicit closing tags because they don’t have any content that needs to be enclosed. Instead, they are written in a specific format, such as <img src="image.jpg" alt="Description">
or <br>
, and the browser understands that they are complete on their own.
How does the browser display texts we write without following the HTML boilerplate standard?
Browsers are designed to be forgiving and lenient when it comes to interpreting HTML code. If you write plain text without following the standard HTML structure (including the <html>
, <head>
, and <body>
tags), the browser will still attempt to display it as best as it can. However, it’s considered good practice to adhere to the HTML boilerplatestandard to ensure proper structure, compatibility, and future-proofing of your web pages.
Can we create our folders in VSC or do we have to create them on other parts of our computer?
Visual Studio Code allows you to create folders within the workspace you’re currently working in. You can right-click on the sidebar or use the “New Folder” option from the File menu to create a new folder directly within VSC. These folders will be reflected in the file system of your computer, allowing you to organize your project files effectively.
What do we mean by HTML element?
In HTML, an element is a building block of a web page. It consists of tags that define the structure and content of specific parts of the page. For example, the <p>
element represents a paragraph, the <h1>
element represents a heading, and the <img>
element represents an image. HTML elements can have attributes that provide additional information or modify their behavior.
How are title and heading tags (such as h1) different?
The title tag <title>
is a specific HTML element used to define the title of a web page. It appears in the browser’s title bar or tabs and is also used by search engines when displaying search results. On the other hand, heading tags (such as <h1>
, <h2>
, etc.) are used to define different levels of headings within the content of a web page, indicating hierarchy and structure. Headings are typically displayed in larger and bolder text, providing visual prominence to the headings.