Select inline elements.

Understanding Inline Elements in HTML

In the world of HTML, elements are primarily divided into two categories, namely 'inline' and 'block level'. Inline elements are those that do not start on a new line and only take up as much width as necessary. This means they flow in line with the text and do not disrupt the document's flow. Two classic examples of inline elements, which were also the correct answers in the quiz, are <span> and <a>.

The Span Element

The <span> tag is a versatile inline element that is utilized to group inline-elements in a document. It provides no visual change by itself. However, when combined with CSS, it can help alter the style, color, or other aspects of specific parts of the text. Here's an example:

<p>
   This is a <span style="color: blue;">blue</span> text.
</p>

In this example, the text within the <span> tag will be shown in blue color.

The Anchor Element

The <a> tag, also known as an anchor tag, is another inline element. It's primarily used to create hyperlinks on web pages that can link to other sections of the same page, different web pages or even different websites. Here's an example:

<p>
    Visit our <a href="https://www.example.com">website</a>.
</p>

In this example, the word 'website' becomes a clickable link leading to 'https://www.example.com'.

Inline vs Block-level Elements

Contrary to inline elements, block-level elements like <p>, <div>, <header>, <footer>, and <table> start on a new line and take up the full width available. They typically contain other block-level or inline elements.

Understanding the difference between inline and block-level elements is vital for effectively organizing and styling web content. For fine-grained control over the appearance of your web pages, use CSS with the HTML elements. Remember, inline elements are best used when you want to change a small portion of your text, whereas block-level elements help structure the larger sections of your layout.

Do you find this helpful?