Questions and Answers
What are the two default display values for most HTML elements?
block or inline
Give examples of block-level elements.
div, p, h1, h2, etc.
What are the characteristics of a block-level element?
Starts on a new line and takes up the full width available.
What are the characteristics of an inline element?
Signup and view all the answers
Give examples of inline elements.
Signup and view all the answers
Which element is a block-level element that is often used as a container for other HTML elements?
Signup and view all the answers
The
Signup and view all the answers
What is an inline element that is often used as a container for some text?
Signup and view all the answers
The element has no required attributes.
Signup and view all the answers
How would 'My Important Heading' appear on a web page?
Signup and view all the answers
How would the information about London appear on a web page?
Signup and view all the answers
Study Notes
Display Values of HTML Elements
- Most HTML elements default to two display values: block and inline.
Block-level Elements
- Block-level elements always start on a new line.
- They extend to fill the entire width available, stretching to both the left and right.
Characteristics of Block-level Elements
- Begin on a new line.
- Occupy full width of their container.
Characteristics of Inline Elements
- Inline elements do not start on a new line.
- They only take up as much width as necessary.
Inline Elements
- Common examples include
<span>
and<a>
.
The <div>
Element
- A block-level element often used as a container for other HTML elements.
Required Attributes of <div>
- False: The
<div>
element has no required attributes, thoughstyle
andclass
are frequently used.
The <span>
Element
- An inline element commonly used as a container for text.
Required Attributes of <span>
- True: The
<span>
has no required attributes, but it often utilizesstyle
andclass
.
Example of Inline Element on a Web Page
- "My Important Heading" would appear in red color and sized at 24px, as an inline element.
Example of Block Element on a Web Page
- "London" as a heading sized at 22px on a black background with white text, includes a description about the city's history and significance, formatted as a block element.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge of HTML block and inline elements with this quiz. Explore definitions, characteristics, and examples of these crucial components of web design. Perfect for beginners and those brushing up on HTML concepts.