HTML Flashcards

1
Q

Where do you put non-visible content about the HTML document?

A

Non-visible content, also known as meta-data, can be placed in the head of an HTML document. This content is not displayed on the web page itself, but is used by web browsers, search engines, and other web-based applications to provide context and additional information about the document.

There are a variety of HTML elements that can be used to include meta-data in the head of an HTML document, including:

title: This element specifies the title of the document, which is used by web browsers and search engines as the title of the page.

meta: This element is used to provide metadata about the document, such as the author, description, keywords, and other information.

link: This element is used to link the document to other resources, such as stylesheets, favicons, and other documents.

script: This element is used to include JavaScript code in the document, which can be used to add interactive functionality to the page.

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

Where do you put visible content about the HTML document?

A

Visible content in an HTML document is typically placed within the body element. The body element contains all of the content that is displayed in the web browser when the page is loaded, including text, images, videos, and other media.

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

Where do the <head> and <body> tags go in a valid HTML document?

A

In a valid HTML document, the head element must be placed within the html element, immediately after the opening html tag. The body element must be placed within the html element, immediately after the head element.

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

What is the purpose of a <!DOCTYPE> declaration?

A

The DOCTYPE declaration is used to specify the type of HTML document. It is placed at the top of an HTML document, before the html element. By specifying a DOCTYPE declaration, you can ensure that the web browser uses standards mode to render the document, which can help to ensure consistent behavior across different web browsers.

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

Give five examples of HTML element types.

A

Here are five examples of HTML element types:

p: The p element represents a paragraph of text.

img: The img element represents an image.

form: The form element represents an HTML form, which is used to collect input from users.

table: The table element represents an HTML table, which is used to display data in a grid format.

div: The div element represents a division or section of the document. It is often used as a container for other HTML elements.

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

What is the purpose of HTML attributes?

A

HTML attributes are used to provide additional information about HTML elements. They are added to the opening tag of an element and take the form of name-value pairs.

Attributes can be used to specify a wide variety of information about an element, such as its id, class, style, src (for images), href (for links), and many other things.

Attributes are optional and an HTML element can have any number of attributes, depending on the needs of the document.

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

Give an example of an HTML entity (escape character).

A

An HTML entity is a special character or symbol that can be represented in HTML using a combination of letters and numbers. These entities are used to display characters that are not available on all keyboards or that have special meaning in HTML.

In this example, the < and > characters are replaced with the < and > entities, respectively. These entities are known as escape characters and are used to represent the < and > characters in HTML.

There are many different HTML entities that can be used in HTML documents. Some common examples include:

&nsb; : non-breaking space
©: copyright symbol
€: Euro symbol
™: trademark symbol
—: em dash
“: left double quotation mark
”: right double quotation mark

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

How do block-level elements affect the document flow?

A

Block-level elements are HTML elements that are formatted as blocks, which means that they take up the full width of their parent container and create a new line before and after themselves. Some examples of block-level elements include div, h1, p, and table.

Block-level elements affect the document flow in several ways:

They create a new line before and after themselves: Because block-level elements take up the full width of their parent container and create a new line before and after themselves, they can be used to structure the content of a web page into distinct sections or blocks.

They can contain inline elements and other block-level elements: Block-level elements can contain both inline elements (such as a, em, and strong) and other block-level elements. This allows you to create complex and hierarchical layouts using a combination of block-level and inline elements.

They can be styled using CSS: You can use CSS to style block-level elements in a variety of ways, such as setting their background color, font size, margins, and padding. This allows you to create a wide range of layouts and visual styles for your web pages.

They affect the way the document is read by assistive technologies: Block-level elements can affect the way the document is read by assistive technologies, such as screen readers. For example, a screen reader might announce the start and end of a block-level element, or use a different voice to distinguish between different types of block-level elements.

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

How do inline elements affect the document flow?

A

Inline elements are HTML elements that are formatted within the flow of a document, rather than as blocks that create a new line before and after themselves. Some examples of inline elements include a, em, strong, and img.

Inline elements affect the document flow in several ways:

They do not create a new line before or after themselves: Because inline elements do not create a new line before or after themselves, they can be used to add small amounts of content within a block of text or other block-level element.

They can only contain other inline elements: Inline elements can only contain other inline elements, not block-level elements. This means that they cannot be used to create complex or hierarchical layouts.

They are affected by the styling of their parent element: Inline elements are affected by the styling of their parent element, as well as by any inline styles applied to them directly. This means that you can use CSS to style inline elements, but the styles will be inherited from the parent element and may be overridden by any inline styles.

They do not affect the way the document is read by assistive technologies: In general, inline elements do not affect the way the document is read by assistive technologies, such as screen readers. These technologies tend to focus on block-level elements and the content within them, rather than on individual inline elements.

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

What are the default width and height of a block-level element?

A

The default width and height of a block-level element depend on the type of element and the parent element it is contained within.

Here are a few general rules to keep in mind:

By default, block-level elements take up the full width of their parent element. For example, if a div element is contained within a body element, it will typically take up the full width of the browser window.

The default height of a block-level element is determined by its content. If the element contains text or other elements, it will be tall enough to contain all of its content. If the element is empty, it will have a default height of 0.

You can use CSS to set the width and height of block-level elements. For example, you can use the width and height properties to set the width and height of a div element.

You can also use the display property to change the way an element is displayed. For example, you can use display: inline-block to make a block-level element behave like an inline element, or display: none to hide the element completely.

It’s important to note that these rules are not absolute and can be overridden by other factors, such as the presence of other elements or the use of CSS.

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

What are the default width and height of an inline element?

A

The default width and height of an inline element depend on the type of element and the content it contains.

Here are a few general rules to keep in mind:

By default, inline elements take up only the space required by their content. For example, if an a element contains a single word, it will be as wide as that word and as tall as the font size of the text.

The default height of an inline element is determined by the font size of the text it contains. If the element is empty, it will have a default height of 0.

The default width of an inline element is determined by the content it contains and the width of its parent element. If the element contains text that wraps to multiple lines, it will be as wide as its parent element.

You can use CSS to set the width and height of inline elements, but these properties may not have the desired effect. In general, it is best to use block-level elements if you need to set the width and height of an element.

It’s important to note that these rules are not absolute and can be overridden by other factors, such as the presence of other elements or the use of CSS.

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

What is the difference between an ordered list and an unordered list in HTML?

A

An ordered list in HTML is a list of items that are numbered in a specific order. An unordered list is a list of items that are not numbered, but are marked with bullet points.

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

Is an HTML list a block element or an inline element?

A

An HTML list (either an ordered list or an unordered list) is a block-level element. This means that it takes up the full width of its parent element and creates a new line before and after itself.

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

What HTML tag is used to link to another website?

A

The a (anchor) element is used to create a hyperlink to another website in HTML. The a element is an inline element, which means that it can be used within a block of text or other inline elements.

You can use the a element to link to any type of web resource, including other HTML pages, images, PDF files, and more. You can also use the a element to create links to specific locations within the same page or to a different page on the same website.

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

What is an absolute URL?

A

An absolute URL is a complete web address that includes the protocol (such as “http” or “https”), the domain name, and the path to a specific resource on the web.

Here is an example of an absolute URL:

Copy code
https://www.example.com/path/to/resource
In this example, “https” is the protocol, “www.example.com” is the domain name, and “/path/to/resource” is the path to the specific resource.

Absolute URLs are used to specify the exact location of a web resource and can be used to link to resources on the same website or on another website.

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

What is a relative URL?

A

A relative URL is a web address that is relative to the current page or to the base URL of the website. A relative URL does not include the protocol (such as “http” or “https”) or the domain name, and is used to link to resources within the same website.

17
Q

What is the purpose of an HTML form element?

A

An HTML form element is used to create a form where users can input information and submit it to a server. The form element is a container for form controls such as text fields, checkboxes, radio buttons and more. Forms are used for a variety of purposes such as login, signup, payment, survey and other types of data collection.

18
Q

Give five examples of form control elements.

A

Five examples of form control elements are:

input: text input, checkbox, radio button and others.
textarea: for multiple lines of text input.
select: for a dropdown menu of options.
button: for submit and reset buttons.
label: for associating a form control with a descriptive text.

19
Q

Give three examples of type attribute values for HTML <input></input> elements.

A

text: for single-line text input.
password: for masked text input, typically used for password fields.
radio: for radio buttons that allow users to select one option from a group of options.

20
Q

Is an HTML <input></input> element a block element or an inline element?

A

An HTML <input></input> element is an inline element. It is typically used to collect small amounts of information from the user, such as text input,

21
Q

What is the default value for the position property of HTML elements?

A

The default value for the position property of HTML elements is “static”, which means that the element will be positioned according to the normal flow of the document.

22
Q

How does setting position: relative on an element affect document flow?

A

When an element is given a position of “relative”, it will still take up space in the document flow and will be affected by the positioning of its neighboring elements. However, you can use offset properties (such as top, right, bottom, and left) to adjust the position of the element relative to where it would normally be positioned.

23
Q

How does setting position: relative on an element affect where it appears on the page?

A

When an element is given a position of “relative” it will still appear in the same spot as it would if it were static. but with position: relative the element is positioned relative to its normal position and it can be adjusted using the offset properties.

24
Q

How does setting position: absolute on an element affect document flow?

A

When an element is given a position of “absolute”, it will be removed from the document flow and will not affect the position of neighboring elements. This means that an absolutely positioned element can overlap other elements on the page.

25
Q

How does setting position: absolute on an element affect where it appears on the page?

A

When an element is given a position of “absolute”, it will be positioned relative to the nearest positioned ancestor element. If there is no positioned ancestor, it will be positioned relative to the initial containing block (usually the browser window).

26
Q

How do you constrain an absolutely positioned element to a containing block?

A

To constrain an absolutely positioned element to a containing block, you need to set the containing block to have a position value of “relative” or “absolute” so that the absolutely positioned element can be positioned relative to it.

27
Q

What are the four box offset properties?

A

The four box offset properties are top, right, bottom, and left. These properties specify the distance of an element’s edges from the edges of its containing block. They can be used to adjust the position of an element that is relatively or absolutely positioned.