Site icon T4Tutorials.com

Cascading Style Sheets MCQs

1. Which CSS property is used to set the height of an element?

(A) element-height


(B) height


(C) line-height


(D) box-height



2. Which property is used to set the width of an element?

(A) width


(B) element-width


(C) max-width


(D) line-width



3. What does the CSS box model consist of?

(A) content, padding, border, margin


(B) content, margin, spacing, border


(C) text, padding, border, margin


(D) margin, padding, outline, text



4. Which property is used to add an outline around an element?

(A) border


(B) outline


(C) frame


(D) box-outline



5. How do you remove an outline from an element?

(A) outline: none;


(B) outline: 0;


(C) border: none;


(D) Both (A) and (B)



6. Which property is used to change the color of text?

(A) text-color


(B) color


(C) font-color


(D) foreground-color



7. How do you make text italic using CSS?

(A) text-style: italic;


(B) font-style: italic;


(C) font-italic: true;


(D) style: italic;



8. Which property is used to change the font size of text?

(A) font-style


(B) text-size


(C) font-size


(D) text-style



9. How do you set a specific font family for an element?

(A) font-family: Arial, sans-serif;


(B) font-type: Arial;


(C) text-font: Arial;


(D) font: Arial;



10. Which property is used to display icons in CSS (like Font Awesome)?

(A) icon


(B) content


(C) font-family


(D) :before



11. How do you remove the underline from a link?

(A) text-decoration: none;


(B) underline: none;


(C) link-decoration: none;


(D) decoration: no-underline;



12. Which property changes the color of links?

(A) link-color


(B) color


(C) text-color


(D) a-color



13. How do you make all links bold using CSS?

(A) a { font-weight: bold; }


(B) link { font-style: bold; }


(C) a { text-style: bold; }


(D) a { font-style: bold; }



14. Which property sets the spacing between lines of text?

(A) letter-spacing


(B) line-height


(C) word-spacing


(D) text-spacing



15. How do you set a maximum width for an element?

(A) max-width: 500px;


(B) width-max: 500px;


(C) element-width: max 500px;


(D) maxsize: 500px;



16. Which property adds space inside the element but outside the content?

(A) margin


(B) padding


(C) border


(D) outline



17. Which property adds space outside the element, separating it from other elements?

(A) margin


(B) padding


(C) border


(D) outline



18. How do you make a link change color when hovered over?

(A) a:hover { color: red; }


(B) a:hovered { color: red; }


(C) a:over { color: red; }


(D) link:hover { color: red; }



19. Which property sets the outline color of an element?

(A) outline-color


(B) border-color


(C) outline-style


(D) border-style



20. Which property is used to change the font weight?

(A) font-style


(B) font-weight


(C) text-weight


(D) text-style



21. Which CSS property is used to control the space between list items?

(A) list-style-type


(B) list-style-position


(C) margin


(D) padding



22. How do you remove bullets from an unordered list in CSS?

(A) list-style: none;


(B) list-type: none;


(C) bullet: off;


(D) display: none;



23. Which CSS property defines the type of marker for list items?

(A) list-style-type


(B) list-marker


(C) marker-type


(D) item-style



24. In a table, which CSS property is used to collapse borders?

(A) border-collapse: collapse;


(B) table-border: collapse;


(C) collapse: border;


(D) border-style: collapse;



25. Which CSS property sets the space between table cells?

(A) cell-spacing


(B) border-spacing


(C) padding


(D) margin



26. Which CSS property is used to control whether an element is inline or block?

(A) visibility


(B) display


(C) position


(D) float



27. Which of the following is NOT a valid value for the CSS display property?

(A) block


(B) inline-block


(C) flex


(D) middle



28. What is the purpose of the max-width property in CSS?

(A) To set a maximum width for an element


(B) To set the minimum width for an element


(C) To make the element fill the viewport


(D) To set width in percentages only



29. Which CSS property would you use to prevent an element from exceeding a certain width?

(A) min-width


(B) max-width


(C) width-limit


(D) overflow-width



30. When using display: inline, which property has no effect on the element?

(A) width


(B) margin


(C) padding


(D) color



31. Which property can be used to change the bullet color in a list?

(A) list-color


(B) color


(C) bullet-color


(D) marker-color



32. How can you display a list horizontally instead of vertically?

(A) display: block;


(B) display: inline;


(C) list-style-type: horizontal;


(D) float: horizontal;



33. In CSS tables, which property is used to style the borders of a table?

(A) border


(B) table-style


(C) cell-border


(D) border-collapse



34. What does border-spacing: 10px; do in a table?

(A) Adds spacing inside cells


(B) Adds spacing between table cells


(C) Removes table borders


(D) Collapses borders



35. Which display value allows an element to behave like a block but flow inline with other content?

(A) inline-block


(B) flex


(C) block


(D) inline



36. What is the default display value of a <div> element?

(A) inline


(B) block


(C) inline-block


(D) flex



37. Which CSS property prevents an element from exceeding a certain width while allowing it to shrink below that width?

(A) min-width


(B) max-width


(C) width


(D) flex-width



38. When using table-layout: fixed;, what happens?

(A) Column widths are automatically determined by content


(B) Column widths are determined by table width and column widths


(C) The table becomes scrollable


(D) Borders are collapsed automatically



39. Which property controls whether list markers appear inside or outside the content box?

(A) list-style-position


(B) list-position


(C) marker-position


(D) position



40. Which CSS display property is used to create a flexible layout system?

(A) grid


(B) block


(C) flex


(D) inline-block



41. How can you prevent table borders from doubling when using border-collapse?

(A) border-style: double;


(B) border-collapse: collapse;


(C) border-spacing: 0;


(D) display: table;



42. Which value of display completely removes an element from the layout flow?

(A) none


(B) hidden


(C) block


(D) inline



43. Which property allows a table cell to span multiple columns?

(A) colspan


(B) rowspan


(C) column-span


(D) cell-span



44. Which CSS property can limit the width of images or elements responsively?

(A) min-width


(B) max-width


(C) width-limit


(D) element-width



45. If a table uses border-collapse: separate;, what property is used to set space between cells?

(A) cell-spacing


(B) border-spacing


(C) padding


(D) margin



46. What happens if an inline element has width set?

(A) It changes the width


(B) The width property is ignored


(C) The element becomes block automatically


(D) It stretches to parent width



47. Which CSS property defines whether list item markers are inside or outside the content box?

(A) list-style-position


(B) marker-inside


(C) position


(D) list-position



48. Which value of display is used to make an element a block-level flex container?

(A) flex


(B) inline-flex


(C) block


(D) grid



49. What is the default border-spacing value for a table?

(A) 0


(B) 1px


(C) 2px


(D) 5px



50. Which CSS property ensures that an image does not exceed its container width while keeping its aspect ratio?

(A) max-width: 100%; height: auto;


(B) width: 100%; height: 100%;


(C) min-width: 100%; height: auto;


(D) overflow: hidden;



Exit mobile version