HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 26
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 name of a group of radio buttons?
A id
B name
C value
D group
2. Which HTML tag is used to embed an audio file?
A <audio>
B <media>
C <sound>
D <music>
3. How do you create a button that changes from red to green when hovered?
A button:hover { color: green; }
B button:hover { background-color: green; }
C button:hover { text-color: green; }
D button:hover { border-color: green; }
4. What is the role of the flex-grow
property in CSS?
A Change content size
B Determine how much space an item should take up in a flex container
C Adjust alignment of flex items
D Change the background color of a flex item
5. How do you make an element completely transparent using CSS?
A opacity: 1;
B visibility: transparent;
C opacity: 0;
D display: none;
6. How do you add a background image to an element in CSS?
A background-image: url("image.jpg");
B image-background: url("image.jpg");
C background: img("image.jpg");
D image-src: url("image.jpg");
7. If you want an element to stay visible at the top of the page even when scrolling, which CSS style would you apply?
A position: sticky; top: 0;
B position: fixed; top: 0;
C position: relative;
D position: absolute;
8. If you want the content of a page to automatically adjust when the screen gets smaller, which approach would you use?
A Use fixed units (px)
B Use position: absolute;
C Use media queries
D Use display: none;
9. How do you create a background image that only repeats vertically and not horizontally?
A background-repeat: no-repeat;
B background-repeat: repeat-y;
C background-repeat: repeat-x;
D background-repeat: repeat;
10. Which HTML tag is used to define a definition list?
A <ol>
B <ul>
C <dl>
D <list>