Mastering HTML Interview Questions Part-2: Explore autofocus, span, blockquote and progress tag
Tags: html, productivity, interview, webdev
Published: 2023-08-12 01:35:13

> _This blog is originally published on my Blog website, where you can find the full version with detailed insights and examples. Click the link below to read the complete article and explore more tech-related content!_
> 👉 [Click Here](https://devwebbytes.blogspot.com/2023/08/mastering-html-interview-questions-set-2.html)

## Introduction

Imagine you're building a house. HTML (Hypertext Markup Language) is like the strong foundation that holds everything together. Knowing some cool HTML tricks can make you a superstar in job interviews.

Welcome back to the second part of our series! We're going to start from the basics and gradually climb up to advanced concepts, just like taking steps up a ladder of knowledge.

In this series, we're unlocking the answers to the first 10 tricky HTML interview questions. Don't worry, we'll keep it super easy with examples. These answers will give you a boost of confidence during interviews, showing off what you know. Let's dive into these questions!

If you're curious to learn more about HTML and its magic, check out the official guide from the World Wide Web Consortium (W3C) at [HTML — World Wide Web Consortium](https://www.w3.org/html/).

For nifty tips and tricks on making HTML work like a charm, the Mozilla Developer Network (MDN) has a user-friendly guide just for you. Discover it at [HTML — Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/HTML).

And if you're interested in making your website easy for everyone to use, the Web Accessibility Initiative (WAI) website is a goldmine of helpful resources. Find them at [Web Accessibility Initiative](https://www.w3.org/WAI/).

Remember, these extra resources can provide more information to help you grasp HTML better, along with the questions and examples we're covering.

## Table Of Contents

1. [How can you set the default checked state for a checkbox or radio button in HTML?](#1)
2. [Explain the purpose of the autofocus attribute in \<input\> tags](#2)
3. [What is the purpose of the span element in HTML?](#3)
4. [What is the purpose of the \<blockquote\> element in HTML?](#4)
5. [Explain the purpose of the contenteditable attribute in HTML.](#5)
6. [What is the purpose of the \<progress\> element in HTML5?](#6)
7. [How can you create a hyperlink that sends an email when clicked?](#7)
8. [How can you create an ordered list in HTML?](#8)
9. [How can you create an unordered list in HTML?](#9)
10. [How can you create an ordered list with uppercase Roman numerals in HTML?](#10)

### 1- How can you set the default checked state for a checkbox or radio button in HTML? <a name="1"></a>
👉 **Answer:**

To make checkboxes or radio buttons start checked, use the checked attribute.

```html
<input type="checkbox" id="myCheckbox" checked>
<label for="myCheckbox">Check me</label>
```

### 2- Explain the purpose of the autofocus attribute in \<input\> tags <a name="2"></a>
👉 **Answer:**

Autofocus makes an input field ready for typing as soon as a webpage loads.

```html
<input type="text" name="username" autofocus>
```

### 3- What is the purpose of the span element in HTML? <a name="3"></a>
👉 **Answer:**

Think of `<span>` as a tiny box for styling parts of a larger text block. It has no semantic meaning on its own but is useful for styling or targeting specific parts of the content.

```html
<p>My name is <span class="highlight">Abidullah786</span>.</p>
```

### 4- What is the purpose of the \<blockquote\> element in HTML? <a name="4"></a>
👉 **Answer:**

The `<blockquote>` element shows quoted content, setting it apart from the rest such as a quote from another source. It helps distinguish quoted content from the surrounding text.

```html
<blockquote>
  <p>This is a quoted text.</p>
</blockquote>
```

### 5- Explain the purpose of the contenteditable attribute in HTML. <a name="5"></a>
👉 **Answer:**

The contenteditable attribute lets you edit an element's content, like a word processor. It can be applied to any HTML element, enabling rich text editing within the browser.

```html
<div contenteditable="true">You can edit this.</div>
```

### 6- What is the purpose of the \<progress\> element in HTML5? <a name="6"></a>
👉 **Answer:**

The `<progress>` element represents the progress of a task or process, providing a visual indication of the completion percentage.

```html
<progress value="69" max="100"></progress>
```

### 7- How can you create a hyperlink that sends an email when clicked? <a name="7"></a>
👉 **Answer:**

Use `mailto:` in the href attribute to create an email link.

```html
<a href="mailto:contact@example.com">Send email</a>
```

### 8- How can you create an ordered list in HTML? <a name="8"></a>
👉 **Answer:**

Use `<ol>` for numbered lists.

```html
<ol>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>
```

### 9- How can you create an unordered list in HTML? <a name="9"></a>
👉 **Answer:**

Use `<ul>` for lists without numbers.

```html
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>
```

### 10- How can you create an ordered list with uppercase Roman numerals in HTML? <a name="10"></a>
👉 **Answer:**

Use the type attribute of the <ol> element and set it to “I” to display uppercase Roman numerals e.g. `<ol type="I">`

```html
<ol type="I">
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ol>
```

## Conclusion

In this second part, we've dived into HTML essentials, empowering you to conquer interviews with confidence. From checkbox tricks to crafting lists and email links, your HTML prowess is growing. Stay curious for our next advanced HTML installment, where we'll build upon this foundation. Keep practicing, and let's continue this journey together!

We're excited to hear your thoughts! Share your comments below.

![Feel Free to Share](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h78nzd4ap1ve1cbped7k.gif)

Let's connect on [Twitter](https://twitter.com/abidullah_786), [LinkedIn](https://www.linkedin.com/in/abidullah786/), and [GitHub](https://github.com/abidullah786) to stay updated and join the conversation!