CSS MCQ
CSS MCQ
Answer: d
2. Which HTML tag is used to link an external CSS file to an HTML document?
a) <style>
b) <link>
c) <css>
d) <external>
Answer: b
3. What is the correct syntax to select an HTML element with the id "header" in CSS?
a) #header
b) .header
c) element#header
d) .header#
Answer: a
a) font-family
b) font-style
c) font-size
d) text-font
Answer: a
5. Which CSS property is used to control the spacing between lines of text?
a) line-spacing
b) text-spacing
c) line-height
d) spacing
Answer: c
c) border-style: solid;
Answer: a
Answer: c
8. Which CSS property is used to control the spacing between individual characters?
a) text-spacing
b) character-spacing
c) letter-spacing
d) space-between
Answer: c
a) align: center;
b) text-align: center;
c) horizontal-align: center;
d) margin: auto;
Answer: b
10. Which CSS selector targets elements that are children of a specific element?
a) >
b) :
c) ~
d) +
Answer: a
a) color
b) text-color
c) font-color
d) style.color
Answer: a
Answer: a
13. Which CSS property is used to control the size of an element's margin?
a) margin-size
b) padding
c) space
d) margin
Answer: d
14. Which CSS property is used to control the size of an element's padding?
a) padding-size
b) margin
c) space
d) padding
Answer: d
15. Which CSS property is used to control the display behavior of an element?
a) display-mode
b) visibility
c) display
d) show
Answer: c
Answer: b
a) solid
b) opaque
c) transparent
d) visibility: hidden;
Answer: c
18. How can you select all paragraphs with the class "intro" in CSS?
a) .intro
b) intro
c) #intro
d) p.intro
Answer: d
Answer: c
20. Which CSS property is used to control the background color of an element?
a) background-color
b) bgcolor
c) color-background
d) style.background-color
Answer: a
a) image: url('image.jpg');
b) background-img: url('image.jpg');
c) background-image: url('image.jpg');
d) img: background('image.jpg');
Answer: c
Answer: b
23. Which CSS property is used to control the order of flexible items in a flex container?
a) order
b) flex-order
c) flex-ordering
d) item-order
Answer: a
24. How can you change the text color of a link that has been visited?
Answer: a
25. Which CSS property is used to control the spacing between columns of a multi-column layout?
a) column-gap
b) gap
c) column-spacing
d) space-between-columns
Answer: a
26. What is the purpose of the CSS property "transform"?
Answer: c
27. How can you select all elements of the class "highlight" that are descendants of a <div> element with
the id "container"?
a) #container .highlight
b) .highlight #container
c) div.highlight
Answer: a
28. Which CSS property is used to control the order of layers in a 3D space?
a) layer-order
b) z-index
c) depth
d) order
Answer: b
29. How can you apply different styles to different media types using CSS?
Answer: b
Answer: a
31. Which CSS property is used to control the shape of the corners of an element?
a) corner-radius
b) border-curve
c) border-radius
d) corner-shape
Answer: c
33. How can you apply different styles to different states of a button, such as hover and active?
a) button:hover { }
b) button.active { }
c) button[state="hover"] { }
d) button[state="active"] { }
Answer: a
34. Which CSS property is used to control the alignment of text within an element?
a) text-align
b) alignment
c) align
d) text-alignment
Answer: a
35. How can you create a smooth transition effect between two CSS property values?
Answer: d
Answer: b
37. Which CSS property is used to control the width of an element's border?
a) border-width
b) border-size
c) width-border
d) border-line
Answer: a
38. How can you apply a style to an element when a user hovers over it?
a) element:hover { }
b) element.hover { }
c) element:active { }
d) element:focus { }
Answer: a
39. Which CSS property is used to control the space between columns in a multi-column layout?
a) column-space
b) column-gap
c) column-margin
d) gap
Answer: b
40. What is the purpose of the CSS property "text-transform"?
Answer: d
41. How can you select the first child element of a parent element in CSS?
a) parent:first-child { }
b) parent:first { }
Answer: d
42. Which CSS property is used to control the amount of space between an element's content and its
border?
a) spacing
b) padding
c) margin
d) gap
Answer: b
Answer: d
Answer: c
45. Which CSS property is used to control the size of an element's text?
a) text-size
b) font-size
c) size
d) text-font
Answer: b
Answer: a
47. How can you apply a background color to an element in CSS?
a) background-color: color;
b) element-bg: color;
c) bg-color: color;
d) color-background: color;
Answer: a
48. Which CSS property is used to control the alignment of flex items along the cross-axis?
a) flex-align
b) cross-align
c) justify-content
d) align-items
Answer: d
Answer: d
50. How can you apply a style to all elements with the class "important" inside a <div> element?
a) div.important { }
c) .important div { }
d) div .important { }
Answer: d