HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 21
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 HTML attribute is used to specify the width of an image?
A width
B height
C size
D length
2. Which CSS property is used to create a shadow around an element?
A box-shadow
B shadow-effect
C text-shadow
D drop-shadow
3. Which CSS property is used to set the thickness of an element’s borders?
A border-style
B border-width
C border-color
D border-radius
4. Which HTML tag is used to define an unordered list?
A <ol>
B <ul>
C <list>
D <li>
5. Which CSS property hides the scrollbar of an element?
A overflow: hidden;
B visibility: hidden;
C scroll: none;
D display: none;
6. What is the purpose of the alt attribute in an <img> tag?
A Display alternative text when the image does not load
B Change the color of the image
C Add a border around the image
D Set the alignment of the image
7. What does the CSS property z-index do?
A Change the color of the element
B Manage the stacking order of elements
C Change the border thickness
D Add a shadow effect
8. What is the role of the href attribute in an <a> tag?
A Define the color of the link text
B Define the web server address
C Define the link text
D Define the destination URL of the link
9. What value of the target attribute opens a link in a new tab or window?
A _self
B _blank
C _top
D _new
10. What value of the CSS property display
hides an element while preserving its space in the document flow?
A none
B block
C inline
D visibility: hidden;