Code Baaj

No 1 Digital Knowledge Website

Most 50 CSS Objective Question And Answer |


βœ… Top 50 CSS Objective Questions & Answers


πŸ”Ή Basic CSS MCQs

  1. What does CSS stand for?
    a) Computer Style Sheets
    b) Colorful Style Sheets
    c) Cascading Style Sheets βœ…
    d) Creative Style Sheets
  2. Which HTML tag is used to link an external CSS file?
    a) <script>
    b) <style>
    c) <css>
    d) <link> βœ…
  3. Which property is used to change the text color in CSS?
    a) font-color
    b) color βœ…
    c) text-color
    d) background-color
  4. What is the correct syntax to comment in CSS?
    a) // comment
    b)
    c) /* comment */ βœ…
    d) ## comment
  5. How do you select an element with id β€œmain”?
    a) #main βœ…
    b) .main
    c) main
    d) *main
  6. How do you select elements with class β€œbox”?
    a) #box
    b) box
    c) .box βœ…
    d) *box
  7. Which property is used to set the background color?
    a) background-color βœ…
    b) color
    c) bg-color
    d) background
  8. What does the z-index property do?
    a) Zoom the element
    b) Stack elements vertically
    c) Set the stack order βœ…
    d) Set text size
  9. How to make text bold in CSS?
    a) font-weight: bold; βœ…
    b) text-weight: bold;
    c) bold: true;
    d) font: bold;
  10. Which unit is not relative in CSS?
    a) em
    b) rem
    c) px βœ…
    d) %

πŸ”Ή Intermediate CSS MCQs

  1. How do you apply a style to all <p> elements?
    a) #p
    b) .p
    c) p βœ…
    d) *p
  2. Which property changes the size of text?
    a) font-size βœ…
    b) text-size
    c) font
    d) size
  3. Which property is used for spacing between lines of text?
    a) spacing
    b) line-spacing
    c) line-height βœ…
    d) height
  4. Which is a valid position property value?
    a) centered
    b) fixed βœ…
    c) float
    d) inline
  5. How do you make an element inline?
    a) display: block;
    b) position: inline;
    c) display: inline; βœ…
    d) inline: true;
  6. Which property removes underline from a link?
    a) link-decoration
    b) text-style
    c) text-decoration βœ…
    d) underline: none
  7. How do you make a list without bullets?
    a) list-style: none; βœ…
    b) bullet: none;
    c) list-type: none;
    d) text-decoration: none;
  8. How do you add space inside an element?
    a) margin
    b) padding βœ…
    c) border
    d) spacing
  9. How to center a block element horizontally?
    a) text-align: center
    b) align: center
    c) margin: auto βœ…
    d) padding: center
  10. What is the default position value of an element?
    a) relative
    b) fixed
    c) static βœ…
    d) absolute

πŸ”Ή Advanced CSS MCQs

  1. Which pseudo-class selects the first child?
    a) :first-child βœ…
    b) :first
    c) :first-element
    d) :child-first
  2. Which selector targets all <p> elements inside a <div>?
    a) div p βœ…
    b) div.p
    c) p > div
    d) div+p
  3. Which CSS feature is used for responsive design?
    a) Animation
    b) Transitions
    c) Media Queries βœ…
    d) Variables
  4. How to define a CSS variable?
    a) $color: red;
    b) –color: red; βœ…
    c) var color = red;
    d) set-color: red;
  5. Which property is used for transitions?
    a) animate
    b) transition βœ…
    c) transform
    d) effect
  6. Which property rotates an element?
    a) position
    b) transition
    c) transform βœ…
    d) skew
  7. Which one is a valid value for display?
    a) invisible
    b) visible
    c) flex βœ…
    d) show
  8. Which shorthand property sets all margin sides?
    a) padding
    b) border
    c) margin βœ…
    d) spacing
  9. What does opacity: 0; do?
    a) Makes element invisible βœ…
    b) Hides content
    c) Reduces font size
    d) Shrinks width
  10. Which layout module uses grid-template-rows?
    a) Flexbox
    b) Grid βœ…
    c) Float
    d) Table

πŸ”Ή CSS Layout & Flexbox MCQs

  1. What is the default direction of flex items?
    a) row βœ…
    b) column
    c) wrap
    d) block
  2. How to create a flex container?
    a) display: flex; βœ…
    b) position: flex;
    c) flex: true;
    d) layout: flex;
  3. Which property aligns items vertically in flexbox?
    a) justify-content
    b) align-items βœ…
    c) align-content
    d) flex-align
  4. Which property aligns items horizontally in flexbox?
    a) justify-content βœ…
    b) align-items
    c) float
    d) align-self
  5. What does flex-wrap: wrap; do?
    a) Prevents overflow
    b) Wraps flex items βœ…
    c) Collapses layout
    d) Hides items
  6. What is the default value of justify-content?
    a) flex-end
    b) space-around
    c) space-between
    d) flex-start βœ…
  7. Which property controls item order in flexbox?
    a) flex-index
    b) order βœ…
    c) z-index
    d) position
  8. How to make an element take remaining space?
    a) flex: auto
    b) flex: 1 βœ…
    c) grow: 1
    d) width: auto
  9. Which layout is best for 2D design (rows + columns)?
    a) Flexbox
    b) Grid βœ…
    c) Float
    d) Table
  10. 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

  1. Which value of position makes element sticky?
    a) static
    b) fixed
    c) relative
    d) sticky βœ…
  2. Which property is used for shadow around boxes?
    a) shadow
    b) box-shadow βœ…
    c) text-shadow
    d) outer-shadow
  3. What is the default display of <span>?
    a) block
    b) inline βœ…
    c) inline-block
    d) flex
  4. How to make a circle using CSS?
    a) border: circle;
    b) border-radius: 50%; βœ…
    c) shape: round;
    d) transform: circle;
  5. 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
  6. What does calc(100% - 50px) do?
    a) Adds 50px
    b) Subtracts 50px βœ…
    c) Multiplies
    d) Divides
  7. Which unit is relative to the font-size of root (html)?
    a) em
    b) rem βœ…
    c) %
    d) vw
  8. Which property is used for transition timing?
    a) transition-speed
    b) timing-function βœ…
    c) speed-function
    d) animate-time
  9. How to animate a hover effect?
    a) :hover + transition βœ…
    b) animation: hover
    c) hover-effect: true
    d) animate-hover
  10. Which tool inspects CSS in browser?
    a) GitHub
    b) Inspect Element βœ…
    c) DevTool
    d) CSS Studio

Digicoders Website Link https://thedigicoders.com/

Leave a Reply

Your email address will not be published. Required fields are marked *