Explore topic-wise MCQs in Css.

This section includes 30 Mcqs, each offering curated multiple-choice questions to sharpen your Css knowledge and support exam preparation. Choose a topic below to get started.

1.

What will happen in this case?p strong {background-color: yellow;}

A. trong have yellow background
B. trong element within a p element have a yellow background
C. oth p and strong have yellow background
D. one of the mentioned
Answer» C. oth p and strong have yellow background
2.

What type of selector is used in this case?

A. class Selectors
B. element Selectors
C. id Selectors
D. none of the mentioned
Answer» C. id Selectors
3.

Which of the following selectors selects direct descendants?

A. E > F
B. E F
C. E + F
D. E ~ F
Answer» B. E F
4.

Which of the following selectors selects adjacent siblings?

A. E > F
B. E F
C. E + F
D. E ~ F
Answer» D. E ~ F
5.

What will be the output of below mentioned code snippet?

A. make that specific paragraph red.
B. error
C. nothing happens
D. none of the mentioned
Answer» B. error
6.

Is this correct way to apply css.State true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
7.

What will be the output of following code snippet?

A. h1 heading becomes green
B. error
C. h1 heading disappears
D. nothing happens
Answer» D. nothing happens
8.

Which style is this?

A. Inline Styles
B. External Style Sheet
C. External Style Sheettyle Sheet
D. None of the mentioned
Answer» B. External Style Sheet
9.

Which of the following selectors selects adjacent siblings?~!

A. E > F
B. E F
C. E + F
D. E ~ F
Answer» D. E ~ F
10.

Which of the following selectors selects the specified elements of type E with a particular class value?~!

A. E.class
B. E ~ F
C. *
D. E, F, G
Answer» B. E ~ F
11.

*$_Which of the following selector selects an element if it’s the only child of its parent??

A. :root
B. :nth-oftype(n)
C. :only-child
D. none of the mentioned
Answer» D. none of the mentioned
12.

*$_Which of the following selector selects the elements that are the default among a set of similar elements??

A. :default
B. :%
C. :disabled
D. none of the mentioned
Answer» B. :%
13.

*$_The _____________ attribute is used to define the name(s) of the class(es) to which a particular tag belongs.?

A. class
B. element
C. id
D. none of the mentioned
Answer» B. element
14.

*/*_Which of the following CSS list properties is/are correct??

A. Set different list item markers for ordered lists
B. Set different list item markers for unordered lists
C. Set an image as the list item marker
D. All of the mentioned
Answer» E.
15.

%_Which of the following selector selects elements that do not match the selector s?_%

A. :!(s)
B. :nth-child(s)
C. :not(s)
D. none of the mentioned
Answer» D. none of the mentioned
16.

%_Which of the following selector selects the elements that are checked?_%

A. E ~ F
B. ::after
C. :checked
D. none of the mentioned
Answer» D. none of the mentioned
17.

%_By applying an ___________ a style can be applied to just a single tag._%

A. class rule
B. element rule
C. id rule
D. none of the mentioned
Answer» D. none of the mentioned
18.

_ Which of the following is the correct way to apply Styles?$?

A. inside an HTML element
B. inside the section of an HTML page
C. in an external CSS file
D. all of the mentioned
Answer» E.
19.

_Which of the following selector selects the element that is the first child of its parent that is of its type?$?

A. :first-of-type
B. :last-child
C. ::first-line
D. ::first-letter
Answer» B. :last-child
20.

_Which of the following selector selects all elements of E that have the attribute attr that end with the given value?$?

A. E[attr^=value]
B. E[attr$=value]
C. E[attr*=value]
D. none of the mentioned
Answer» C. E[attr*=value]
21.

_p {line-height: 150%;}.What type of selector is used in this case?$?

A. class Selectors
B. element Selectors
C. id Selectors
D. none of the mentioned
Answer» C. id Selectors
22.

_The _______property is used to set the color of the text.$?

A. pallet
B. colour
C. color
D. text-decoration
Answer» D. text-decoration
23.

Which of the following selector selects the elements that are currently enabled??

A. :element
B. :empty
C. :enabled
D. none of the mentioned
Answer» D. none of the mentioned
24.

The __________ property specifies the type of positioning method used for an element.?

A. align
B. float
C. position
D. padding
Answer» D. padding
25.

Which of the following selector applies styles to elements that are valid per HTML5 validations set either with the pattern or type attributes??

A. :valid
B. :required
C. :optional
D. :invalid
Answer» B. :required
26.

What will happen in this case?

text

A. make that specific paragraph red.
B. error
C. nothing happens
D. none of the mentioned
Answer» B. error
27.

Which of the following selector selects an element that has no children?

A. :empty
B. :nochild
C. :inheritance
D. :no-child
Answer» B. :nochild
28.

A ___________ is used to define a special state of an element.

A. pseudo-tag
B. pseudo-element
C. pseudo-id
D. pseudo-class
Answer» E.
29.

Which of the following selector selects the element that is the target of a referring URI?

A. :target
B. :selection
C. ::selection
D. :URI
Answer» B. :selection
30.

Which of the following is the correct way to applying style to a document?

A. Use an external style sheet, either by importing it or by linking to it
B. Directly embed a document-wide style in the head element of the document
C. Set an inline style rule using the style attribute directly on an element
D. All of the mentioned
Answer» E.