OA Exams
Which CSS property is used to set the space between an element’s content and its border?
a) marginb) paddingc) border-spacingd) spacing
Correct Answer: b) padding
Explanation: The padding property controls the space between the content of an element and its border.
Which CSS property is used to create rounded corners on an element?
a) border-radiusb) corner-radiusc) border-roundd) corner
Correct Answer: a) border-radius
Explanation: The border-radius property allows you to add rounded corners to elements in CSS.
Which of the following is not a valid way to specify colors in CSS?
a) rgb(255, 0, 0)b) #ff0000c) 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;.
Which CSS property specifies whether an element should float to the left or right?
a) positionb) clearc) floatd) align
Correct Answer: c) float
Explanation: The float property specifies whether an element should float to the left or right of its containing element.
Which CSS property is used to stop elements from floating?
a) floatb) clearc) stop-floatd) cancel
Correct Answer: b) clear
Explanation: The clear property stops floating elements and forces the next element to appear on a new line.
Which CSS property is used to specify the display behavior of an element?
a) visibilityb) displayc) positiond) content
Correct Answer: b) display
Explanation: The display property determines how an element is displayed on the page, such as block, inline, or none.
Which CSS property controls the layout of flex items in a flex container?
a) displayb) flexc) flex-directiond) 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.
Which CSS property defines the gap between flex items?
a) paddingb) marginc) gapd) spacing
Correct Answer: c) gap
Explanation: The gap property defines the space between rows and columns of items in a flex or grid container.
Which CSS property is used to adjust the stacking order of positioned elements?
a) positionb) displayc) z-indexd) stack-order
Correct Answer: c) z-index
Explanation: The z-index property controls the stacking order of elements that overlap.
Which of the following is a valid pseudo-class in CSS?
a) :hoverb) ::beforec) @hoverd) hover:
Correct Answer: a) :hover
Explanation: The :hover pseudo-class is triggered when a user hovers over an element.
Which CSS property controls the speed of a CSS animation between keyframes?
a) animation-durationb) animation-timing-functionc) transitiond) animation-speed
Correct Answer: b) animation-timing-function
Explanation: The animation-timing-function property controls how an animation progresses between keyframes.
How do you create a CSS variable with global scope?
a) Declare it in the .root selectorb) Declare it in the :root selectorc) Use the @variable ruled) 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.
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.
Which of the following is not a valid unit for specifying lengths in CSS?
a) pxb) emc) cmd) hm
Correct Answer: d) hm
Explanation: hm is not a valid unit in CSS; px, em, and cm are valid units for specifying lengths.
Which CSS layout mode provides an efficient way to lay out items in a container?
a) gridb) flexboxc) tabled) float
Correct Answer: b) flexbox
Explanation: Flexbox provides an efficient way to arrange items in a container that adjusts for different screen sizes.
Which CSS property determines whether flex items wrap onto multiple lines in a flex container?
a) flex-wrapb) flex-basisc) flex-growd) 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.
Which CSS property specifies the number of columns in a grid container?
a) grid-columnsb) grid-template-columnsc) column-countd) columns
Correct Answer: b) grid-template-columns
Explanation: The grid-template-columns property defines the number and width of columns in a grid container.
Which CSS property is used to control where elements should appear in the browser?
a) floatb) displayc) positiond) z-index
Correct Answer: c) position
Explanation: The position property determines where elements are positioned in the browser window.
Which of the following is a valid CSS transition property?
a) transition-propertyb) animate-propertyc) keyframe-transitiond) change-duration
Correct Answer: a) transition-property
Explanation: The transition-property specifies which properties should be animated during a transition.
Which CSS property is used to apply a transformation to an element, such as rotation or scaling?
a) transformb) rotatec) skewd) animation
Correct Answer: a) transform
Explanation: The transform property is used to rotate, scale, or move elements.