HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 30
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 CSS property allows you to change the color of an element smoothly when a user hovers over it?
A transition: color 0.5s;
B hover: color 0.5s;
C color: transition 0.5s;
D color: smooth;
2. Which CSS property allows you to rotate an element around its axis by 45 degrees?
A transform: 45deg
B transform-rotate(45deg)
C rotate(45)
D rotate(45deg)
3. Which HTML tag is used to create an input field for a phone number?
A <input type="number">
B <input type="tel">
C <input type="phone">
D <input type="text">
4. What does the CSS property position: absolute;
do?
A It fixes an element relative to its nearest parent with a defined position.
B It positions an element relative to the browser window.
C It moves an element absolutely within the page.
D It prevents an element from moving inside its container.
5. Which CSS property allows you to apply a smooth transition on multiple properties of an element?
A transition-properties: all;
B transition-duration: 1s;
C transition-timing: ease-in;
D transition: all 1s ease;
6. Which HTML attribute is used to group multiple options in a form for better organization?
A fieldset
B group
C optgroup
D selectgroup
7. Which CSS selector targets all <p>
elements inside an element with the class .content?
A .content > p
B .content p
C p.content
D #content p
8. Which HTML entity displays the “©” symbol?
A ©
B &symbol;
C ©-symbol;
D &right-symbol;
9. Which CSS property adds a text shadow to an element?
A text-shadow
B box-shadow
C shadow-text
D shadow-box
10. Which HTML attribute is used to specify the width and height of an image before it is fully loaded?
A srcset
B width and height
C img-size
D loading="lazy"