β Top 50 CSS Objective Questions & Answers
πΉ Basic CSS MCQs
- What does CSS stand for?
a) Computer Style Sheets
b) Colorful Style Sheets
c) Cascading Style Sheets β
d) Creative Style Sheets - Which HTML tag is used to link an external CSS file?
a)<script>
b)<style>
c)<css>
d)<link>
β - Which property is used to change the text color in CSS?
a) font-color
b) color β
c) text-color
d) background-color - What is the correct syntax to comment in CSS?
a) // comment
b)
c) /* comment */ β
d) ## comment - How do you select an element with id βmainβ?
a) #main β
b) .main
c) main
d) *main - How do you select elements with class βboxβ?
a) #box
b) box
c) .box β
d) *box - Which property is used to set the background color?
a) background-color β
b) color
c) bg-color
d) background - What does the
z-index
property do?
a) Zoom the element
b) Stack elements vertically
c) Set the stack order β
d) Set text size - How to make text bold in CSS?
a) font-weight: bold; β
b) text-weight: bold;
c) bold: true;
d) font: bold; - Which unit is not relative in CSS?
a) em
b) rem
c) px β
d) %
πΉ Intermediate CSS MCQs
- How do you apply a style to all
<p>
elements?
a) #p
b) .p
c) p β
d) *p - Which property changes the size of text?
a) font-size β
b) text-size
c) font
d) size - Which property is used for spacing between lines of text?
a) spacing
b) line-spacing
c) line-height β
d) height - Which is a valid position property value?
a) centered
b) fixed β
c) float
d) inline - How do you make an element inline?
a) display: block;
b) position: inline;
c) display: inline; β
d) inline: true; - Which property removes underline from a link?
a) link-decoration
b) text-style
c) text-decoration β
d) underline: none - How do you make a list without bullets?
a) list-style: none; β
b) bullet: none;
c) list-type: none;
d) text-decoration: none; - How do you add space inside an element?
a) margin
b) padding β
c) border
d) spacing - How to center a block element horizontally?
a) text-align: center
b) align: center
c) margin: auto β
d) padding: center - What is the default position value of an element?
a) relative
b) fixed
c) static β
d) absolute
πΉ Advanced CSS MCQs
- Which pseudo-class selects the first child?
a) :first-child β
b) :first
c) :first-element
d) :child-first - Which selector targets all
<p>
elements inside a<div>
?
a) div p β
b) div.p
c) p > div
d) div+p - Which CSS feature is used for responsive design?
a) Animation
b) Transitions
c) Media Queries β
d) Variables - How to define a CSS variable?
a) $color: red;
b) –color: red; β
c) var color = red;
d) set-color: red; - Which property is used for transitions?
a) animate
b) transition β
c) transform
d) effect - Which property rotates an element?
a) position
b) transition
c) transform β
d) skew - Which one is a valid value for
display
?
a) invisible
b) visible
c) flex β
d) show - Which shorthand property sets all margin sides?
a) padding
b) border
c) margin β
d) spacing - What does
opacity: 0;
do?
a) Makes element invisible β
b) Hides content
c) Reduces font size
d) Shrinks width - Which layout module uses
grid-template-rows
?
a) Flexbox
b) Grid β
c) Float
d) Table
πΉ CSS Layout & Flexbox MCQs
- What is the default direction of flex items?
a) row β
b) column
c) wrap
d) block - How to create a flex container?
a) display: flex; β
b) position: flex;
c) flex: true;
d) layout: flex; - Which property aligns items vertically in flexbox?
a) justify-content
b) align-items β
c) align-content
d) flex-align - Which property aligns items horizontally in flexbox?
a) justify-content β
b) align-items
c) float
d) align-self - What does
flex-wrap: wrap;
do?
a) Prevents overflow
b) Wraps flex items β
c) Collapses layout
d) Hides items - What is the default value of
justify-content
?
a) flex-end
b) space-around
c) space-between
d) flex-start β - Which property controls item order in flexbox?
a) flex-index
b) order β
c) z-index
d) position - How to make an element take remaining space?
a) flex: auto
b) flex: 1 β
c) grow: 1
d) width: auto - Which layout is best for 2D design (rows + columns)?
a) Flexbox
b) Grid β
c) Float
d) Table - Whatβs the use of
min-height
?
a) Sets height limit
b) Sets min font
c) Sets minimum height β
d) Hides overflow
πΉ Miscellaneous & Modern CSS
- Which value of position makes element sticky?
a) static
b) fixed
c) relative
d) sticky β - Which property is used for shadow around boxes?
a) shadow
b) box-shadow β
c) text-shadow
d) outer-shadow - What is the default display of
<span>
?
a) block
b) inline β
c) inline-block
d) flex - How to make a circle using CSS?
a) border: circle;
b) border-radius: 50%; β
c) shape: round;
d) transform: circle; - Which media query is used for screens below 768px?
a)@media (max-width: 768px)
β
b)@media screen <= 768
c)@media (width < 768)
d)@media-size: 768
- What does
calc(100% - 50px)
do?
a) Adds 50px
b) Subtracts 50px β
c) Multiplies
d) Divides - Which unit is relative to the font-size of root (
html
)?
a) em
b) rem β
c) %
d) vw - Which property is used for transition timing?
a) transition-speed
b) timing-function β
c) speed-function
d) animate-time - How to animate a hover effect?
a):hover
+transition
β
b)animation: hover
c)hover-effect: true
d)animate-hover
- Which tool inspects CSS in browser?
a) GitHub
b) Inspect Element β
c) DevTool
d) CSS Studio
Leave a Reply