HTML Exam 5: Modern HTML5 Features (10 Challenges)
HTML Exam 5: Mastery and Modern Features
Test your knowledge of modern HTML5 elements, APIs, and performance optimization techniques.
Use the <dialog> element to create a simple modal window with a “Hello” message and a close button. Give it the id “myModal”.
<dialog id="myModal">
<p>Hello there!</p>
<form method="dialog">
<button>Close</button>
</form>
</dialog>
Make an image (`img`) draggable using the `draggable` attribute.
<img src="image.jpg" draggable="true" alt="Draggable image">
Create a form with two range inputs and an <output> element that displays their sum. (HTML only.)
<form oninput="result.value = parseInt(a.value) + parseInt(b.value)">
<input type="range" id="a" value="50"> +
<input type="range" id="b" value="50"> =
<output name="result" for="a b">100</output>
</form>
Use Microdata attributes (itemscope, itemtype, itemprop) to define a Person named “Ali” with the job title “Developer”.
<div itemscope itemtype="https://schema.org/Person">
<span itemprop="name">Ali</span>
<span itemprop="jobTitle">Developer</span>
</div>
Write a <link> tag to preload the font file “font.woff2” to improve performance.
<link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin>
Use the global `hidden` attribute to hide a <p> element with the text “Coming soon” without using CSS.
<p hidden>Coming soon</p>
You have a sentence that mixes languages and want to isolate the direction of an English username. Use the appropriate tag (<bdi>).
<p>User <bdi>User123</bdi> won the game.</p>
1. Disable spellcheck for a text input field.
2. Prevent translation of a company name using `translate=\"no\"` inside a paragraph.
<input type="text" spellcheck="false">
<p>Welcome to <span translate="no">Google</span>.</p>
Write a meta tag that defines a Content Security Policy allowing scripts only from the same origin (`self`).
<meta http-equiv="Content-Security-Policy" content="script-src 'self'">
Use `srcset` and `sizes` on an `img` tag to provide different image versions based on screen width (e.g., a small image up to 600px and a larger one above that).
<img src="small.jpg"
srcset="small.jpg 500w, medium.jpg 1000w, large.jpg 1500w"
sizes="(max-width: 600px) 500px, 100vw"
alt="Responsive image">