HTML/CSS MCQs – Multiple Choice Questions and Answers – Part 42
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 CSS trick that prevents text from overflowing a container?
A overflow: hidden;
B text-overflow: ellipsis;
C white-space: nowrap;
D All of the above
2. What does the CSS property writing-mode: vertical-rl;
do?
A Allows text to be written from right to left, bottom to top
B Changes text from horizontal alignment to vertical, with a right-to-left flow
C Creates text that moves vertically from top to bottom
D Writes text vertically from bottom to top
3. What is the effect of the CSS property transition: all 0.3s ease-in-out;
?
A Applies a transition to all elements on the page
B Creates a transition with a duration of 0.3 seconds, with a smooth starting transition (ease-in) and a smooth ending transition (ease-out)
C Changes the color of all elements on hover
D Applies an infinite animation
4. What effect do you get by applying filter: blur(5px);
to an image?
A The image becomes sharper
B The image becomes blurred with a blur of 5 pixels
C The image is divided into sections
D The image changes color
5. If you want the list items to be displayed horizontally (side by side), which CSS property would you use?
A list-style-type: none;
B display: inline-block;
C display: block;
D float: left;
6. What does the term “CSS Grid” mean?
A A type of table structure in CSS
B A layout method that arranges elements in rows and columns
C A property that defines the borders of an element
D A method of background gradient
7. What does the CSS property text-transform: capitalize;
do?
A Converts all text to uppercase
B Converts all text to lowercase
C Capitalizes the first letter of each word
D Applies a capital letter to each character
8. What does the property box-sizing: border-box;
do?
A Includes borders and margins in the element’s dimensions
B Changes the behavior of flexible boxes
C Ensures that borders and padding are included in the element’s dimensions, rather than being added to them
D Changes the shape of boxes based on the content
9. What does the CSS property flex-wrap: wrap;
do in CSS Flexbox?
A Forces all elements to stay on a single line
B Allows elements to move in any order
C Allows elements to move to the next line when there is not enough space
D Reorganizes elements into columns
10. What is the correct syntax to use a custom font in CSS?
A font-family: "Arial", sans-serif;
B font-face: "Arial";
C @font-face { font-family: "CustomFont"; src: url("custom-font.woff2"); }
D font-family: url("custom-font.woff2");