-
web.groovymark@gmail.com
- December 14, 2024
Question 21
Which CSS property is used to set the space between an element’s content and its border?
a) margin
b) padding
c) border-spacing
d) spacing
Correct Answer: b) padding
Explanation: The padding property controls the space between the content of an element and its border.
Question 22
Which CSS property is used to create rounded corners on an element?
a) border-radius
b) corner-radius
c) border-round
d) corner
Correct Answer: a) border-radius
Explanation: The border-radius property allows you to add rounded corners to elements in CSS.
Question 23
Which of the following is not a valid way to specify colors in CSS?
a) rgb(255, 0, 0)
b) #ff0000
c) rgba(255, 0, 0, 0.5)
d) color:red
Correct Answer: d) color:red
Explanation: While red is a valid color keyword, color:red is not a valid way to specify colors in CSS; it should be color: red;.
Question 24
Which CSS property specifies whether an element should float to the left or right?
a) position
b) clear
c) float
d) align
Correct Answer: c) float
Explanation: The float property specifies whether an element should float to the left or right of its containing element.
Question 25
Which CSS property is used to stop elements from floating?
a) float
b) clear
c) stop-float
d) cancel
Correct Answer: b) clear
Explanation: The clear property stops floating elements and forces the next element to appear on a new line.
Question 26
Which CSS property is used to specify the display behavior of an element?
a) visibility
b) display
c) position
d) content
Correct Answer: b) display
Explanation: The display property determines how an element is displayed on the page, such as block, inline, or none.
Question 27
Which CSS property controls the layout of flex items in a flex container?
a) display
b) flex
c) flex-direction
d) flex-layout
Correct Answer: c) flex-direction
Explanation: The flex-direction property controls the direction in which flex items are laid out inside a flex container.
Question 28
Which CSS property defines the gap between flex items?
a) padding
b) margin
c) gap
d) spacing
Correct Answer: c) gap
Explanation: The gap property defines the space between rows and columns of items in a flex or grid container.
Question 29
Which CSS property is used to adjust the stacking order of positioned elements?
a) position
b) display
c) z-index
d) stack-order
Correct Answer: c) z-index
Explanation: The z-index property controls the stacking order of elements that overlap.
Question 30
Which of the following is a valid pseudo-class in CSS?
a) :hover
b) ::before
c) @hover
d) hover:
Correct Answer: a) :hover
Explanation: The :hover pseudo-class is triggered when a user hovers over an element.
Question 31
Which CSS property controls the speed of a CSS animation between keyframes?
a) animation-duration
b) animation-timing-function
c) transition
d) animation-speed
Correct Answer: b) animation-timing-function
Explanation: The animation-timing-function property controls how an animation progresses between keyframes.
Question 32
How do you create a CSS variable with global scope?
a) Declare it in the .root selector
b) Declare it in the :root selector
c) Use the @variable rule
d) Use the global-variable property
Correct Answer: b) Declare it in the :root selector
Explanation: CSS variables with global scope are declared inside the :root selector.
Question 33
What is the correct syntax for defining a CSS variable called –main-color?
a) –main-color: blue;
b) main-color: blue;
c) color: –main-color;
d) @main-color: blue;
Correct Answer: a) --main-color: blue;
Explanation: CSS variables are defined with two dashes (--) followed by the variable name.
Question 34
Which of the following is not a valid unit for specifying lengths in CSS?
a) px
b) em
c) cm
d) hm
Correct Answer: d) hm
Explanation: hm is not a valid unit in CSS; px, em, and cm are valid units for specifying lengths.
Question 35
Which CSS layout mode provides an efficient way to lay out items in a container?
a) grid
b) flexbox
c) table
d) float
Correct Answer: b) flexbox
Explanation: Flexbox provides an efficient way to arrange items in a container that adjusts for different screen sizes.
Question 36
Which CSS property determines whether flex items wrap onto multiple lines in a flex container?
a) flex-wrap
b) flex-basis
c) flex-grow
d) align-items
Correct Answer: a) flex-wrap
Explanation: The flex-wrap property controls whether flex items are forced into one line or wrapped onto multiple lines.
Question 37
Which CSS property specifies the number of columns in a grid container?
a) grid-columns
b) grid-template-columns
c) column-count
d) columns
Correct Answer: b) grid-template-columns
Explanation: The grid-template-columns property defines the number and width of columns in a grid container.
Question 38
Which CSS property is used to control where elements should appear in the browser?
a) float
b) display
c) position
d) z-index
Correct Answer: c) position
Explanation: The position property determines where elements are positioned in the browser window.
Question 39
Which of the following is a valid CSS transition property?
a) transition-property
b) animate-property
c) keyframe-transition
d) change-duration
Correct Answer: a) transition-property
Explanation: The transition-property specifies which properties should be animated during a transition.
Question 40
Which CSS property is used to apply a transformation to an element, such as rotation or scaling?
a) transform
b) rotate
c) skew
d) animation
Correct Answer: a) transform
Explanation: The transform property is used to rotate, scale, or move elements.