Basic HTML | HTML Fundamentals Flashcards

1
Q

What does the div element represent in HTML?

A

A flexible container that can be styled and used to group other elements together

The div can be given height, width, and background color using CSS.

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

Write an example of a basic div element.

A

<div></div>

This is the simplest form of a div element.

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

How can a div be utilized without styling?

A

To hold and group other elements together

For example, a heading and a paragraph can be placed inside a div.

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

Provide an example of a div containing a heading and a paragraph.

A

<div><h1>I am a heading</h1><p>I am a paragraph</p></div>

This shows how elements can be grouped within a div.

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

What is an alternative to using a div for grouping elements?

A

The section element

The section element has semantic meaning, unlike the div.

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

What does semantic meaning refer to in HTML?

A

The meaning of elements that allows browsers to understand their purpose

For example, a section element indicates a thematic grouping.

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

How does a browser treat a section element?

A

It recognizes its semantic meaning and understands it as a section

This applies across different devices like desktops and mobiles.

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

True or False: The div element has semantic meaning.

A

False

The div is described as a ‘mysterious ghost’ without semantic significance.

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

What does the id attribute do in HTML?

A

Adds a unique identifier to an HTML element

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

How should id names be used in an HTML document?

A

They should not be used more than once and must always be unique

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

What symbol is used to reference an id in CSS?

A

The hash symbol (#)

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

What characters are allowed in id attribute values?

A

Letters, digits, underscores, and dashes

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

True or False: id attribute values can contain spaces.

A

False

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

What is the purpose of the class attribute in HTML?

A

To apply styles to multiple elements without needing uniqueness

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

How can multiple class names be applied to a single HTML element?

A

By separating the names with a space

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

What symbol is used to reference a class in CSS?

A

The dot symbol (.)

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

When is it best to use an id versus a class?

A

Use id for specific elements and class for multiple elements

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

Fill in the blank: The id attribute value cannot have _______.

A

spaces

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

What happens if you use a space in an id attribute value?

A

Browsers will see the space as part of the id, causing issues

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

What are the allowed characters for class attribute values?

A

Letters, digits, underscores, dashes, and spaces

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

What is the effect of the following CSS rule: #title { color: red; }?

A

Changes the text color of the element with id ‘title’ to red

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

What is the example HTML code for a div with a class called ‘box’?

A

<div></div>

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

What does the following CSS rule do: .box { width: 200px; height: 200px; border: 2px solid black; }?

A

Sets width, height, and border properties for elements with class ‘box’

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

What is an HTML entity?

A

A set of characters used to represent a reserved character in HTML.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What happens when the HTML parser sees the less than (<) symbol followed by an HTML tag name?
It interprets that as an HTML element.
26
How can you fix the issue of the HTML parser misinterpreting the less than symbol?
By using HTML entities.
27
What is the correct HTML entity for the less than symbol?
<
28
What is the correct HTML entity for the greater than symbol?
>
29
What are named character references?
Character references that start with an ampersand sign (&) and end with a semicolon (;).
30
What does the updated paragraph element look like when using named character references?
This is an <img /> element.
31
What is a decimal numeric reference?
A character reference that starts with an ampersand sign and hash symbol (#), followed by one or more decimal digits, followed by a semicolon.
32
What is the decimal numeric reference for the less than symbol?
<
33
What is a hexadecimal numeric reference?
A character reference that starts with an ampersand sign, hash symbol, and the letter x, followed by one or more ASCII hex digits and ends with a semicolon.
34
What is the hexadecimal numeric reference for the less than symbol?
<
35
What are some common symbols that use HTML entities?
* Copyright symbol (©) * Quotes (" ) * Trademark symbol (™) * Ampersand sign (&)
36
What is the purpose of the script element in HTML?
To embed executable code, primarily JavaScript
37
What is JavaScript commonly used for in web development?
To add interactivity to web pages, such as interactive games, image sliders, and dynamic forms
38
Fill in the blank: The script element is used to _______ executable code.
[embed]
39
What does the src attribute in the script element specify?
The location of the external JavaScript file
40
True or False: It is considered best practice to write all JavaScript code inside the script tags.
False
41
What does 'src' stand for?
'source'
42
What is the design principle that encourages separating JavaScript from HTML?
Separation of concerns
43
Fill in the blank: The separation of concerns principle involves dividing programs into distinct sections that address separate _______.
[concerns]
44
What happens when the page first loads in the example provided?
An alert pops up with the message 'Welcome to freeCodeCamp'
45
What is a common user interaction with the alert in the example?
The user clicks the OK button to dismiss the message
46
Why is it discouraged to place all JavaScript inside the HTML document?
To maintain separation of concerns
47
What is an example of embedding JavaScript directly in an HTML document?
48
Fill in the blank: The script element can be used to link to an _______ JavaScript file.
[external]
49
What does SEO stand for?
Search Engine Optimization
50
What is the purpose of the meta description element?
To provide a short description for the web page
51
How does the meta description affect SEO?
It can improve visibility and potentially increase traffic, though it won't directly affect ranking
52
What attribute is set to 'description' in the meta element?
name
53
Where is the content of the meta description placed?
In the content attribute
54
How should meta descriptions be structured?
Short and concise
55
What happens to meta descriptions on search engine results pages?
They may be truncated based on the results page layout
56
True or False: Meta descriptions are visible on the web page itself.
False
57
Where can you find the page description in search engine results?
In the search engine results page snippet
58
What is one potential benefit of having a strong meta description?
Increased traffic to your website
59
Fill in the blank: The meta description will not directly affect a site's ______.
ranking
60
Provide an example of a meta description for a gardening site.
Discover expert tips and techniques for gardening in small spaces, choosing the right plants, and maintaining a thriving garden.
61
How does a user benefit from reading a meta description in search results?
They can quickly get a general sense of what the page is about
62
What is the role of the open graph tag?
The open graph protocol enables you to control how your website's content appears across various social media platforms.
63
How do open graph properties affect user engagement?
By setting these properties, you can entice users to want to click and engage with your content.
64
Where are open graph properties set in a website's HTML?
Inside the HTML head section through a collection of meta elements.
65
What is the first important OG property to include?
The title.
66
Provide an example of setting the OG title.
67
What is the second important OG property?
The type.
68
Provide an example of using the OG type.
69
What does the type property represent?
The type of content being shared on social media.
70
What is the third important OG property?
The image.
71
Provide an example of setting the OG image.
72
What should be considered for the open graph image?
Images should be high quality with good dimensions and ratios.
73
What are the recommended image dimensions for best display on high-resolution devices?
At least 1200 by 630 pixels.
74
What is the fourth important OG property?
The url.
75
Provide an example of setting the OG url.
76
What are some other OG properties that can be set?
* description * audio * video * locale
77
How do open graph properties affect Search Engine Optimization?
Well-crafted OG properties can enhance the appearance for your content in users' feeds.
78
What can higher click-through rates signal to search engines?
That your content is relevant and engaging.