HTML Document Standards Flashcards

1
Q

<!DOCTYPE html>

A

Must be the first line of code in an HTML document

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What must be the second line of code in an HTML document so that HTML structure and content can be created or inputted?

A

<html></html>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Head Element

A

<head></head>

Used for metadata of a webpage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Title Element

A

<title></title>

Tab’s title

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Anchor Element

A

<a></a>
A link
Must have an href attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

href Attribute

A

href=hypertext reference. This attribute is what will contain the URL for the anchor element. Any content put in the anchor element is what the link will say.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Target Attribute

A

Specifies how a link should open.
For example, _blank means the link will open in a new window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linking to a Relative Page

A

When having a link to a relative page, it is going to be a relative path instead of an absolute path. The link will be to a file in the same folder as the file you are already one.
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Linking an Image

A

Put an anchor element outside of an image element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Linking to the Same Page

A

In order to link to a target on the same page, we must give the target an id, like this:

<p>This is the top of the page!</p>

<h1>This is the bottom! </h1>

An id should be descriptive to make it easier to remember the purpose of a link. The target link is a string containing the # character and the target element’s id.

<ol>
<li><a>Top</a></li>
<li><a>Bottom</a></li>
</ol>

In the example above, the links to <p id="top"> and <h1 id="bottom"> are embedded in an ordered list. These links appear in the browser as a numbered list of links. An id is especially helpful for organizing content belonging to a div!

Do not wrap the entire <li> element in the anchor element, only the content inside.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Comments

A

<!--comment-->

Helps you (and others) understand your code if you decide to come back and review it at a much later date. Also allows you to experiment with new code, without having to delete old code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly