CSS Quiz (Beginner) - All Questions
This CSS Beginner Quiz helps learners test their foundational knowledge of Cascading Style Sheets. It covers core CSS concepts, syntax, and properties commonly used in web design and beginner-level interviews.
Question 1: What does CSS stand for?
- Creative Style Sheets
- Cascading Style Sheets
- Computer Style Sheets
- Colorful Style Sheets
Explanation: CSS stands for Cascading Style Sheets and is used to style HTML elements.
Question 2: Which HTML tag is used to apply internal CSS?
- <css>
- <style>
- <script>
- <link>
Explanation: The <style> tag is used to define internal CSS.
Question 3: Which attribute is used to link an external CSS file?
Explanation: The href attribute specifies the path to the CSS file.
Question 4: Which CSS property is used to change text color?
- font-color
- text-color
- color
- foreground
Explanation: The color property sets the color of text.
Question 5: Which selector selects all elements?
Explanation: The universal selector () selects all elements.
Question 6: How do you select an element with id 'header'?
- .header
- header
- #header
- *header
Explanation: The # symbol is used to select elements by id.
Question 7: How do you select elements with class name 'box'?
Explanation: The dot (.) selector is used for class names.
Question 8: Which property controls the text size?
- font-style
- font-size
- text-size
- size
Explanation: font-size defines the size of text.
Question 9: Which CSS property is used to change background color?
- bgcolor
- background-color
- color
- background
Explanation: background-color sets the background color of an element.
Question 10: Which CSS property is used to make text bold?
- font-style
- text-weight
- font-weight
- bold
Explanation: font-weight controls the thickness of text.
Question 11: Which property is used to align text horizontally?
- align
- text-align
- horizontal-align
- position
Explanation: text-align aligns text horizontally.
Question 12: Which unit is relative to the parent element?
Explanation: em is relative to the parent element’s font size.
Question 13: Which property adds space inside an element?
- margin
- spacing
- padding
- border
Explanation: padding adds space inside the element boundary.
Question 14: Which property adds space outside an element?
- padding
- margin
- border
- outline
Explanation: margin controls space outside an element.
Question 15: Which CSS property is used to add borders?
- border-style
- outline
- border
- frame
Explanation: border is a shorthand property for borders.
Question 16: Which value makes an element invisible but still take space?
- display: none
- visibility: hidden
- opacity: 0
- hidden
Explanation: visibility: hidden hides the element but keeps its space.
Question 17: Which CSS property controls element visibility?
- display
- visibility
- opacity
- hidden
Explanation: visibility controls whether an element is visible.
Question 18: Which property changes the font type?
- font-style
- font-family
- font-weight
- font-variant
Explanation: font-family specifies the typeface.
Question 19: Which property is used to underline text?
- text-style
- font-decoration
- text-decoration
- underline
Explanation: text-decoration controls text decorations.
Question 20: Which selector selects all <p> elements?
Explanation: Using the element name selects all such elements.
Question 21: Which CSS property sets the width of an element?
Explanation: width sets the horizontal size of an element.
Question 22: Which CSS property sets the height of an element?
- height
- size
- length
- vertical-size
Explanation: height defines the vertical size of an element.
Question 23: Which value positions an element relative to itself?
- absolute
- fixed
- relative
- static
Explanation: relative positioning offsets the element from itself.
Question 24: What is the default position value?
- relative
- absolute
- static
- fixed
Explanation: static is the default position value.
Question 25: Which property changes the mouse cursor?
Explanation: cursor changes the mouse pointer style.
Question 26: Which pseudo-class applies when hovering over an element?
- :focus
- :active
- :hover
- :visited
Explanation: :hover applies when the mouse is over an element.
Question 27: Which CSS property controls element stacking order?
Explanation: z-index controls stacking order of positioned elements.
Question 28: Which property rounds the corners of an element?
- corner-radius
- border-radius
- round
- radius
Explanation: border-radius rounds element corners.
Question 29: Which property controls transparency?
- transparent
- visibility
- opacity
- filter
Explanation: opacity controls element transparency.
Question 30: Which unit is relative to the viewport width?
Explanation: vw represents viewport width units.
Question 31: Which CSS property repeats background images?
- background-repeat
- repeat
- background-style
- bg-repeat
Explanation: background-repeat controls image repetition.
Question 32: Which value centers text horizontally?
Explanation: center is used with text-align to center text.
Question 33: Which property controls list bullet style?
- list-type
- list-style-type
- bullet-style
- marker
Explanation: list-style-type controls list markers.
Question 34: Which CSS property removes underline from links?
- text-decoration: none
- link-style: none
- underline: none
- decoration: off
Explanation: text-decoration: none removes link underline.
Question 35: Which selector targets direct child elements?
Explanation: > selects direct child elements.
Question 36: Which CSS property sets element display type?
- position
- display
- visibility
- float
Explanation: display controls how elements are rendered.
Question 37: Which value hides an element completely?
- visibility: hidden
- opacity: 0
- display: none
- hidden
Explanation: display: none removes the element from layout.
Question 38: Which property floats an element to the left?
Explanation: float positions elements left or right.
Question 39: Which CSS property clears floated elements?
- clear
- reset
- overflow
- float-clear
Explanation: clear prevents floating elements from overlapping.
Question 40: Which selector selects the first child?
- :first
- :first-child
- :child-first
- :start
Explanation: :first-child selects the first child element.
Question 41: Which property controls overflow behavior?
Explanation: overflow controls content outside element bounds.
Question 42: Which CSS property makes text italic?
- font-style
- font-weight
- text-style
- italic
Explanation: font-style: italic makes text italic.
Question 43: Which selector targets elements on focus?
- :hover
- :active
- :focus
- :visited
Explanation: :focus applies when an element receives focus.
Question 44: Which property sets space between letters?
- line-height
- word-spacing
- letter-spacing
- text-spacing
Explanation: letter-spacing controls space between characters.
Question 45: Which CSS property controls line spacing?
- line-height
- spacing
- text-height
- row-gap
Explanation: line-height controls vertical spacing between lines.
Question 46: Which selector selects all descendants?
Explanation: The space selector selects all descendant elements.
Question 47: Which property sets background image?
- image
- background-image
- bg-image
- background
Explanation: background-image sets an image as background.
Question 48: Which CSS property sets element outline?
Explanation: outline draws a line outside the border.
Question 49: Which value makes font bold?
Explanation: bold is a valid font-weight value.