HTML Basics Flashcards

(16 cards)

1
Q

What does HTML stand for and what is its primary purpose?

A

HTML stands for HyperText Markup Language. Its primary purpose is to meaningfully markup content so that browsers can make sense of it and understand the structure and meaning of the content.

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

What is the fundamental principle for choosing HTML elements, and what should you NOT base your choice on?

A

Choose HTML elements based on meaning and context of your content, NOT on their visual appearance or styling. HTML is for semantic markup - CSS handles the visual presentation.

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

What are the three components that make up a complete HTML element?

A
  1. Opening tag (e.g., <p>) 2. Content (the actual text or nested elements) 3. Closing tag (e.g., </p>). Together they form a complete element structure.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does HTML code execution work, and why is this important to understand?

A

HTML code runs sequentially from top to bottom. This means the order of elements in your code determines the order they appear on the page and how they’re processed by the browser.

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

What are HTML attributes, where do they go, and how are they formatted?

A

Attributes are added to HTML opening tags to alter element behavior. They’re separated by spaces and each holds a value mentioned in quotes. Example: <img></img>

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

How does HTML handle whitespace, and what does this mean for your code formatting?

A

All whitespace is ignored in HTML. Multiple tabs, spaces, or line breaks get converted into single spaces when the page renders. This means you can format your code for readability without affecting the display.

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

What’s the difference between <h1> and <h6> elements, and what do heading elements represent?

A

Heading elements go from <h1> to <h6>, representing different levels of importance and hierarchy. <h1> is the most important/largest heading, <h6> is the least important/smallest. They create document structure, not just visual size.

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

Write a complete paragraph element with some sample text.

A

<p>This is the homepage of my awesome website.</p>

  • Notice the opening <p> tag, content in the middle, and closing </p> tag.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What makes the <img></img> element different from other HTML elements in terms of structure?

A

The <img></img> element is a self-closing tag - it doesn’t have a separate closing tag. It’s closed by putting a forward slash before the closing bracket, like <img></img>.

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

List the four main attributes of the <img></img> element and explain what each does.

A

src: specifies the image file path/URL, alt: provides alternative text for accessibility, width: sets image width in pixels, height: sets image height in pixels. Example: <img></img>

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

What’s the difference between a <button> element and an <a> element in terms of functionality?</a></button>

A

<button> creates a clickable button for actions/interactions within the page. <a> (anchor) creates links that navigate to other pages or locations. Buttons perform actions, links navigate.</a></button>

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

Write an anchor element that opens a link in a new tab, and explain the two key attributes.

A

<a>Click here to go to Example.com</a> - href specifies the destination URL, target=’_blank’ opens link in new tab (default is same tab).

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

Where should the <style> element be placed in an HTML document and what is its purpose?</style>

A

The <style> element should be placed in the <head> section of the HTML document. Its purpose is to add CSS styling code directly within the HTML document for internal styling.</style>

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

You need to create a webpage section with a main heading, a paragraph, and an image. Write the HTML structure.

A

<h1>Welcome to My Website</h1>

<p>This is the homepage of my awesome website.</p>

<img></img>

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

What’s wrong with this HTML approach: using <h1> for small text because you like how it looks, and <p> for headings because you prefer that font?

A

This violates HTML’s semantic principle. Elements should be chosen for meaning, not appearance. <h1> represents the main heading regardless of size, <p> represents paragraph text. Use CSS to control visual appearance, not wrong HTML elements.

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

How do you make a link that opens in the same tab vs a new tab, and which is the default behavior?

A

Same tab (default): <a>Link text</a> - New tab: <a>Link text</a> - Default behavior is opening in the same tab unless target=’_blank’ is specified.