HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 46
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. Which tag is used to group form elements?
A <fieldset>
B <form-group>
C <group>
D <fieldset-group>
2. Which HTML tag is used to define a clickable image?
A <link>
B <a>
C <button>
D <img>
3. Which tag defines a section for inserting source code on a webpage?
A <code>
B <pre>
C <script>
D <source>
4. Which HTML tag displays a progress bar?
A <progress>
B <meter>
C <bar>
D <indicator>
5. Which CSS selector targets all <p>
elements that are children of a <div>
?
A div + p
B div ~ p
C div > p
D div p
6. You have a list of items and want to apply a special style to only the first item. Which CSS selector would you use?
A li:first-child
B li:first-of-type
C ul:first-child
D li:nth-child(1)
7. You want to apply a style to all elements that have a data-status
attribute with the value “active”. Which CSS selector would you use?
A [data-status="active"]
B [data-status^="active"]
C [data-status*="active"]
D [data-status$="active"]
8. Imagine you want to apply a style to all <p>
elements that contain text between parentheses. Which CSS selector would you use for this case?
A p:contains("(")
B p:has("(")
C p:empty
D There is no CSS selector for this
9. You want to apply a hover color effect to all <button>
elements except for one particular button, which has id="special"
. What combination of CSS selectors would you use?
A button:hover, button#special:hover
B button:hover:not(#special)
C button:hover, #special
D button:not(#special):hover
10. Which tag is used to add information about the author of an HTML document, typically placed within the <footer>
?
A <author>
B <address>
C <footer>
D <info>