code academy: Preparing for HTML

Ace your homework & exams now with Quizwiz!

HTML files require certain elements to set up the document properly. What is the first element?

*always type <!DOCTYPE html> on the first line of code in your HTML document. It tells the browser what type of document to expect, along with what version of HTML is being used in the document. HTML code is always saved in a file with an .html extension.

Which of the following tags instructs the browser to expect a well-formed HTML document?

<!DOCTYPE html>

What does this syntax mean?

<a href="./contact.html">Contact</a> In this example, the <a> tag is used with a relative path to link from the current HTML file to the contact.html file in the same folder. On the web page, Contact will appear as a link. A relative path is a filename that shows the path to a local file (a file on the same website, such as ./index.html) versus an absolute path (a full URL, like https://www.codecademy.com/learn/learn-html which is stored in a different folder). The ./ in ./index.html tells the browser to look for the file in the current folder. <a href="./index.html">Brown Bear</a>

<title>Codecademy</title> The following HTML code should only exist within which of the following tags?

<head>

Which of the following elements contains a web page's metadata?

<head>

All HTML code must be nested within which of the following tags?

<html>

What kind of metadata about the web page can the <head> element contain?

A browser's tab displays the title specified in the <title> tag. The <title> tag is always inside of the <head>. <!DOCTYPE html> <html> <head> <title>My Coding Journal</title> </head> </html> If we were to open a file containing the HTML code in the example above, the browser would display the words My Coding Journal in the title bar (or in the tab's title).

<a href="https://www.codecademy.com/">Codecademy</a> The following code creates a link to another page. Which of the following will cause the page to open in a new browser window?

Add the target attribute, with its value set to _blank

how do you add comments in HTML?

Comments begin with <!-- and end with -->. Any characters in between will be ignored by your browser. <!-- This is a comment that the browser will not display. -->

What is the Head in HTML?

The <head> element is part of this HTML metaphor. It goes above our <body> element.The <head> element contains the metadata for a web page. Metadata is information about the page that isn't displayed directly on the web page. Unlike the information inside of the <body> tag, the metadata in the head is information about the page itself. You'll see an example of this in the next exercise. The opening and closing head tags typically appear as the first item after your first HTML tag:

How do you use a attribute called target?

The target attribute specifies how a link should open. For a link to open in a new window, the target attribute requires a value of _blank. The target attribute can be added directly to the opening tag of the anchor element, just like the href attribute. <a href="https://en.wikipedia.org/wiki/Brown_bear" target="_blank">The Brown Bear</a>

HTML files require certain elements to set up the document properly. What is the second element?

To create HTML structure and content, we must add opening and closing <html> tags after declaring <!DOCTYPE html>: <html></html> Anything between the opening <html> and closing </html> tags will be interpreted as HTML code. Without these tags, it's possible that browsers could incorrectly interpret your HTML code.

Why should the document type declaration be included in all HTML documents?

To specify the HTML standard being used in the content

What is the World Wide Web Consortium?

W3C, is responsible for maintaining the style standards of HTML. At the time of writing

Explain how you can link pages on the internet using HTML?

You can add links to a web page by adding an anchor element <a> and including the text of the link in between the opening and closing tags. This attribute stands for hyperlink reference and is used to link to a path, or the address to where a file is located (whether it is on your computer or another location). The paths provided to the href attribute are often URLs. <a href="https://www.wikipedia.org/">This Is A Link To Wikipedia</a>

How does HTML allow you to turn any element into a link?

by wrapping that element with an anchor element. For example, you can turn a img tab into a link. <a href="https://en.wikipedia.org/wiki/Opuntia" target="_blank"><img src="https://www.Prickly_Pear_Closeup.jpg" alt="A red prickly pear fruit"/></a>

When making multi-page static websites, where do you store HTML files?

often HTML files are stored in the root directory, or a main folder where all the files for the project are stored. As the size of the projects you create grows, you may use additional folders within the main project folder to organize your code. project-folder/ |—— about.html |—— contact.html |—— index.html Because the files are stored in the same folder, we can link web pages together using a relative path.

The contents of the <title> tag will appear where in a modern browser?

the browser's tab


Related study sets

Chapter 5 wellness relationships

View Set

ExamFX Fed Tax, Health Ins Basics, Indiv Health & Dis Ins

View Set

Organizational Behavior Chapter 1

View Set