HTML Unit 1: Basics, styles, formatting and quotations Flashcards
What is the correct HTML code to create a heading?
`<h1>This is a heading</h1>
<h2>This is a subheading</h2>
<h3>This is a smaller heading</h3>
<h4>This is an even smaller heading</h4>
<h5>This is a tiny heading</h5>
<h6>This is the smallest heading</h6>
`<h1>
is the largest heading, while <h6>
is the smallest.
Headings help structure the content on a webpage for both users and search engines.
How do you create an HTML <h1>
heading with a font size of 60px?
<h1 style="font-size:60px;">Heading 1</h1>
The style attribute is used for inline CSS to apply specific styling directly to the HTML element.
In this case, it changes the font size of the <h1>
tag to 60px.
How do you insert a line break using HTML?
The <br>
tag is used to insert a line break in text.
It is a self-closing tag, used to break content into a new line without starting a new paragraph.
What does the <hr>
tag do in HTML?
The <hr>
tag creates a horizontal rule or line, often used to separate content.
It is a self-closing tag and does not require a closing tag.
How is the <pre>
tag used in HTML, and what does it do?
<pre>
This is preformatted
text.
</pre>
The <pre>
tag is used for preformatted text.
It preserves both spaces and line breaks, displaying the content exactly as written.
What is the purpose of the <p>
tag in HTML?
<p>This is a paragraph.</p>
The <p>
tag defines a paragraph of text.
Browsers automatically add some space before and after paragraphs.
How do you use the style attribute in HTML to apply CSS to an element?
<p style="color:blue; font-size:20px;">This is a styled paragraph.</p>
The style attribute is used to apply inline CSS directly to an HTML element.
The format is style="property:value;"
.
In this example:color:blue;
changes the text color to blue.font-size:20px;
sets the font size to 20px.
What is the difference between inline, internal, and external CSS? Change the body’s background to powderblue.
Inline: <body style="background-color:powderblue;">
</body>
Internal: <style>body {
background-color: powderblue;}</style>
External: <link rel="stylesheet" href="styles.css">
/* In styles.css */
body {
background-color: powderblue;
}
How can you apply red text color to a paragraph using inline CSS?
<p style="color:red;">This is a paragraph.</p>
How do you apply the Courier font to a paragraph using inline CSS?
<p style="font-family:courier;">This is a paragraph.</p>
How do you increase the text size of a paragraph using inline CSS?
<p style="font-size:160%;">This is a paragraph.</p>
How do you center-align a paragraph using inline CSS?
<p style="text-align:center;">Centered paragraph.</p>
What does the HTML <b>
element do?
The <b>
tag is used to create bold text.
It does not imply any extra importance or emphasis, just bold styling.
What is the purpose of the HTML <strong>
element?
The <strong>
tag is used to indicate text with strong importance. By default, the text inside is typically displayed in bold, but it also conveys semantic meaning, suggesting that the content has significant importance.
What does the HTML <i>
element do, and when might it be used?
The <i>
tag defines text in an alternate voice or mood, often displayed in italic.
Commonly used for:
Technical terms
Foreign phrases
Thoughts
Names of ships or other works