css banner

CSS Multiple Choice Questions (MCQs) and Answers

Master CSS with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of CSS. Begin your placement preparation journey now!

Q91

Q91 How can you make text italic in CSS?

A

font-style: italic;

B

text-style: italic;

C

font-weight: italic;

D

style: italic;

Q92

Q92 How do you specify a fallback font in CSS?

A

font-family: "Helvetica", "Arial", sans-serif;

B

font-family: "Helvetica" or "Arial";

C

font-family: primary: "Helvetica", secondary: "Arial";

D

font: "Helvetica", "Arial";

Q93

Q93 Why might text not appear in the specified font-family in CSS?

A

The font is not installed on the user's system

B

The browser does not support the font

C

The font-family is misspelled

D

All of the above

Q94

Q94 What could cause the text-transform property to not work as expected?

A

Incorrect property value

B

The property is applied to a non-text element

C

Inheritance issues

D

Both A and C are correct

Q95

Q95 How can you fix text that overflows its container?

A

Use the overflow property

B

Apply text-overflow: ellipsis;

C

Increase the container size

D

Both B and C are correct

Q96

Q96 How do you remove the default list-style-type from an unordered list?

A

list-style-type: none;

B

list-style: no-bullet;

C

list-style: none;

D

list-bullet: none;

Q97

Q97 Which property is used to specify the space between cells in a table?

A

cell-spacing

B

cell-padding

C

border-spacing

D

padding

Q98

Q98 How can you make a table's borders collapse into a single border?

A

border-collapse: collapse;

B

border-style: collapse;

C

table-border: single;

D

border: single;

Q99

Q99 What CSS property is used to control the list item marker type in an ordered list?

A

list-style-type

B

list-item-type

C

list-marker-type

D

list-number-type

Q100

Q100 How do you align text to the right in table headers?

A

text-align: right; in <th>

B

align: right; in <th>

C

<th align="right">

D

<th style="text-align: right;">

Q101

Q101 Which CSS property is used to set the style of the bottom border of a table cell?

A

border-bottom-style

B

cell-border-bottom

C

table-cell-border

D

border-style-bottom

Q102

Q102 How do you set the background color for all <th> elements in a table?

A

th { background-color: #eee; }

B

table th { color: #eee; }

C

th { color: background; }

D

table { th-background: #eee; }

Q103

Q103 How can you style every alternate row of a table to have a gray background?

A

tr:nth-child(even) { background-color: #eee; }

B

tr:even { background-color: #eee; }

C

table tr:nth-of-type(even) { background-color: #eee; }

D

tr:nth-row(even) { background-color: #eee; }

Q104

Q104 How do you apply a border to only the left side of a table cell?

A

td { border-left: 1px solid black; }

B

td: border { left: 1px solid black; }

C

td { left-border: 1px solid black; }

D

table-cell { border-left: 1px solid black; }

Q105

Q105 Why might a table's borders not be visible even after setting border:
1px solid black;?

A

The border-collapse property is not set

B

The border color matches the background color

C

The border style is not specified correctly

D

All of the above

Q106

Q106 What could cause list item markers to not appear in an unordered list?

A

Setting list-style-type: none;

B

The list is inside a container with overflow: hidden;

C

Incorrect use of the ul element

D

Both A and B are correct

Q107

Q107 How can you fix the issue of table cells not aligning properly with their headers?

A

Ensure the number of cells matches the number of headers

B

Set explicit widths on headers and cells

C

Use vertical-align to align cell content

D

Both A and B are correct

Q108

Q108 What is the purpose of CSS transitions?

A

To change property values smoothly over a given duration

B

To create movement using keyframes

C

To pause animations

D

To manipulate images

Q109

Q109 Which property is essential for defining the duration of a CSS transition?

A

transition-duration

B

transition-property

C

transition-timing-function

D

transition-delay

Q110

Q110 What does the animation-direction property do?

A

Determines the speed curve of the animation

B

Specifies whether the animation should play in reverse on alternate cycles

C

Defines how many times an animation should play

D

Specifies the name of the @keyframes animation

Q111

Q111 How do you specify the timing function of a transition?

A

Using the transition-timing-function property

B

With the transition-duration property

C

By setting the transition-delay property

D

Through the animation-timing-function property

Q112

Q112 What is the difference between CSS transitions and animations?

A

Transitions require a trigger, like a hover, whereas animations do not

B

Animations can only be applied to :hover states

C

Transitions can manipulate SVGs, but animations cannot

D

There is no difference; they are interchangeable

Q113

Q113 Which CSS property allows you to delay the start of a transition?

A

transition-delay

B

animation-delay

C

transition-duration

D

animation-duration

Q114

Q114 How do you apply a basic opacity transition to an element on hover?

A

.element:hover { transition: opacity 0.5s ease; opacity: 0.5; }

B

.element { transition: opacity 0.5s ease-in-out; } .element:hover { opacity: 0.5; }

C

.element { opacity: 1; } .element:hover { opacity: 0.5; transition: 0.5s; }

D

All of the above

Q115

Q115 How can you make an animation loop infinitely?

A

animation-iteration-count: infinite;

B

animation-repeat: forever;

C

animation-loop: infinite;

D

animation-duration: infinite;

Q116

Q116 What feature do keyframe animations offer that transitions do not?

A

Triggering without user interaction

B

Requiring a hover state

C

Dependence on JavaScript

D

Limitation to transform properties

Q117

Q117 What is a potential downside of setting a transition duration to 0s?

A

Makes the transition instant and potentially jarring

B

Prevents the transition from running

C

Is the recommended practice for subtle effects

D

None, it optimizes performance

Q118

Q118 How can you troubleshoot an animation that does not start?

A

Ensure the @keyframes rule is correctly defined

B

Check that the animation name matches the @keyframes name

C

Verify the animation-duration is not set to 0s

D

All of the above

Q119

Q119 What could be the reason for an animation to run once and not repeat despite using animation-iteration-count: infinite;?

A

The animation is not linked to the correct element

B

The browser does not support infinite animations

C

A syntax error in the @keyframes definition

D

The animation-name property is missing or incorrect

Q120

Q120 What is a CSS pseudo-class?

A

A special class added to elements via JavaScript

B

A class that targets specific states of an element

C

A syntax for defining default styles

D

A method to style elements based on their content type

ad verticalad vertical
ad