List of CSS MCQs
List of CSS MCQs
5. In a CSS file, there is a CSS rule for paragraphs tags – what does p
can be called?
A. Selector
B. Attribute
C. Property
D. Tag
Answer: A) Selector
Explanation:
In a CSS rule, the HTML element(s) for them we are writing the CSS is known
as "CSS Selector".
OR
/*
This is
a multi-line
comment
*/
13. Which property is used to define the font of the element's text?
A. font
B. font-family
C. font-style
D. All of the above
Answer: B) font-family
Explanation:
The font-family property is used to define the font of the element's text.
Example:
p
{
font-family: "Times New Roman", Times, serif;
}
18. Which is the correct inline CSS for p tag to define paragraph's
text and background colors?
A. <p css="color: red; background-color: yellow;">
B. <p cssstyle="color: red; background-color: yellow;">
C. <p inline="color: red; background-color: yellow;">
D. <p style="color: red; background-color: yellow;">
Answer: D) <p style="color: red; background-color: yellow;">
Explanation:
The correct inline CSS style is,
<p style="color: red; background-color: yellow;">Paragraph
Text.</p>
28. Which CSS property is used to specify the space between the
characters in a text?
A. text-space
B. letter-space
C. letter-spacing
D. letter-distance
Answer: C) letter-spacing
Explanation:
The letter-spacing property is used to specify the space between the
characters in a text.
Example:
p {
letter-spacing: 5px;
}
29. Which CSS property is used to specify the space between lines?
A. line-space
B. line-spacing
C. line-padding
D. line-height
Answer: D) line-height
Explanation:
The line-height property is used to specify the space between lines.
Example:
p {
line-height: 2.0;
}
30. Which CSS property is used to specify the space between the
words in a text?
A. word-spacing
B. word-padding
C. word-height
D. characters-spacing
Answer: A) word-spacing
Explanation:
The word-spacing property is used to specify the space between the words
in a text.
Example:
p {
word-spacing: 10px;
}
33. Which is the correct CSS statement to capitalize the first letter
of each word?
A. text-transform: uppercase
B. text-transform: capitalize
C. text-transform: sentence
D. Both A. and B.
Answer: B) text-transform: capitalize
Explanation:
The correct CSS statement is to capitalize the first letter of each word,
p {
text-transform: capitalize;
}
36. Which CSS property specifies how to align the last line of a text?
A. text-align
B. last-text-align
C. text-align-last-line
D. text-align-last
Answer: D) text-align-last
Explanation:
The text-align-last property specifies how to align the last line of a text.
Example:
p {
text-align-last: right;
}
40. Which CSS property specifies the type of list item marker?
A. list-style
B. list-style-type
C. list-style-circle
D. list-style-square
Answer: B) list-style-type
Explanation:
The list-style-type property specifies the type of list item marker.
Example:
ul {
list-style-type: circle;
}
42. Which CSS property specifies an image as the list item marker?
A. list-style-image
B. list-style-picture
C. list-style-background
D. list-style-bgimage
Answer: A) list-style-image
Explanation:
The list-style-image property specifies an image as the list item marker.
Example:
ul {
list-style-image: url('sqpurple.gif');
}
43. Which CSS property specifies if/how an element is displayed?
A. block
B. display
C. element-display
D. element-block
Answer: B) display
Explanation:
The display property specifies if/how an element is displayed.
Example:
ul {
display: block;
}
61. This selector selects all the <h> elements where the parent is a
<div> element.
A. h + p
B. h > p
C. p.h
D. p > h
Answer: B) h > p
Explanation:
This is an element>element selector in which operand on the left side of
child combinator (>) is the parent and operand on the right side is the child
element.
63. Which is the most widely used font in customizing web pages?
A. Times New Roman
B. Georgia
C. Arial
D. Garamond
Answer: C) Arial
Explanation:
Arial (sans-serif) is the most widely used font on web pages.
65. We can give space between unit and value when assigning
length values to CSS properties.
A. True
B. False
Answer: B) False
Explanation:
If you give a space between unit and value, the property won't be injected
in div.
70. Which line of code specifies playing an animation with the same
speed from beginning to the end?
A. div {animation- timing function: linear;}
B. div {animation- timing function: ease in;}
C. div {animation- play- state: paused;}
D. div {animation- fill-mode: both;}
Answer: A) div {animation- timing function: linear;}
Explanation:
We use the animation- timing- function property to define the time an
animation uses to change from one set of CSS styles to another. When we
set its value to linear, the animation will have the same speed from start to
end.
A. collapse
B. separate
C. initial
D. inherit
Answer: B) separate
Explanation:
When we set the value of border:collapse property to separate, each cell will
display its borders.
75. Which cursor property value indicates that the program is busy?
A. help
B. default
C. auto
D. wait
Answer: D) wait
Explanation:
When we set the cursor property value to wait, the cursor indicates that the
program is busy.
82. In the given line of code, identify the type of selector used.
#Main {background-color: yellow;}
A. CSS element selector
B. CSS id selector
C. Combinator selector
D. All of the above
Answer: B) CSS id selector
Explanation:
The id selector uses the id attribute of an HTML element to select a specified
element.
Syntax:
#id attribute {CSS property}
86. In this line of code, what is the use of the alt attribute?
<img src="circle.jpg" alt="It is red">
A. Adds a text description to an image
B. Provides alternative information for an image
C. To hide an image
D. Both A & B
Answer: D) Both A & B
Explanation:
The alt attribute is used to provide alternative information for an image if a
user fails to view an image on the webpage and also it tells us something
related to the image.
87. The CSS border property specifies the style, color, and ___ of an
element's border.
A. length
B. size
C. width
D. area
Answer: C) width
Explanation:
The CSS border properties specify the style, color, and width of an element's
border. The border property is a shorthand property for border-width, border-
style, and border-color.
88. To get this output, the CSS properties put to use are ___.
90. What is the default size for normal text, like paragraphs?
A. 11px
B. 12px
C. 16px
D. 18px
Answer: C) 16px
Explanation:
If we don't specify a font size, the default size for normal texts is "16px" or
"1em".