HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 37
Multiple choice questions and answers (MCQs) on HTML/CSS to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on basic techniques such as tags, web standards, CSS selector, objects, and more. This quiz will easily prepare anyone to pass their online test.
1. What is the correct way to add an emoji (like a heart ❤️) in HTML text?
A <p>❤️</p>
B <p>💛</p>
C <p>❤</p>
D All of the above
2. Which HTML tag lets you add an icon next to a heading?
A <h1><svg>...</svg> Title</h1>
B <h1><i class="icon"></i> Title</h1>
C <h1><span class="icon"></span> Title</h1>
D <h1><img src="icon.png" alt="icon"> Title</h1>
3. Which CSS property allows you to make a menu fixed at the top of the page, even when scrolling?
A position: sticky; top: 0;
B position: fixed; top: 0;
C position: absolute; top: 0;
D A and B
4. How do you define and use a CSS variable for background color?
A --primary-color: #3498db;
B background-color: var(--primary-color);
C :root { --primary-color: #3498db; }
D A and B
5. How do you create a list of links that are displayed horizontally?
A ul { list-style-type: none; } li { display: inline; }
B ul { list-style: none; } li { display: block; }
C ul { list-style-type: inline; } li { display: inline-block; }
D ul { list-style: none; } li { display: flex; }
6. Which HTML tag adds alternative text for a video for accessibility?
A <video><track src="captions.vtt" kind="subtitles" srclang="en" label="English"></video>
B <video alt="Video not accessible">Video</video>
C <video><caption>Video</caption></video>
D <video><p>Video</p></video>
7. How do you add a clickable link to an image in HTML?
A <a src="https://example.com"><img href="image.jpg"></a>
B <link href="https://example.com"><img src="image.jpg"></link>
C <a href="https://example.com"><img src="image.jpg"></a>
D <img href="https://example.com" src="image.jpg">
8. How do you make an HTML table responsive on smaller screens?
A By using overflow-x: auto;
on the table container
B By using table-layout: auto;
on the <table>
tag
C By adding a <responsive-table>
tag
D By setting a fixed width for table columns
9. What is the HTML code to display the copyright symbol (©)?
A ©
B ©
C ©
or ©
D <copyright>
10. How do you create a numbered list with custom bullet styles (like numbers as letters)?
A <ol style="list-style-type: upper-alpha;">
B <ul style="list-style-type: circle;">
C <ol type="I">
D <ol style="list-style-type: decimal;">