CSS MCQs

50
Score: 0
Attempted: 0/50
1. Which of the following is the correct way to select an element with id “header” in CSS?



2. How do you write a comment in CSS?


3. Which CSS property is used to change the text color of an element?



4. How can you add a background image to a webpage using CSS?



5. Which CSS property is used to set the border width of an element?



6. How can you select all <p> elements inside a <div> element?


7. Which of the following is an example of an invalid CSS statement?



8. How do you set the top margin of an element to 50 pixels?



9. Which property is used to add space inside an element, between the content and the border?



10. Which of the following is NOT a valid CSS color format?



11. Which selector is used to select all elements on a page?



12. How do you apply a CSS rule to all elements of class “menu”?



13. Which CSS property is used to change the font of text?



14. How do you make a list not display bullets?



15. Which property controls the transparency of an element?



16. Which of the following is the correct way to write multiple CSS rules for a single element?



17. How do you select an element with the class “active” that is inside a <nav> element?



18. Which property is used to set the background color of an element?



19. Which of the following is the correct way to include an external CSS file in HTML?
21. Which property is used to set the style of a border (e.g., solid, dashed, dotted)?



22. How do you set all four borders of an element to 5 pixels solid black in a single line?



23. Which property is used to set the horizontal space outside an element?



24. Which property is used to set the vertical spacing inside an element?



25. Which of the following is a valid CSS color name?



26. How can you hide an element visually but keep it accessible to screen readers?



27. Which property is used to set a background image that does not repeat?



28. Which CSS statement contains a syntax error?



29. How do you set the background color with transparency?



30. Which CSS property is shorthand for setting all four margins at once?



31. Which of the following selectors will select all <a> elements inside a <li>?


32. How do you make text bold using CSS?



33. Which property controls the space between the border and the element content?



34. How can you select all <p> elements that are direct children of a <div>?
37. Which property is used to change the space between letters in text?



38. Which of the following is NOT a valid way to specify a color in CSS?



39. How do you create a border that is 2 pixels thick, dashed, and blue?



40. Which property sets the background image position?



41. Which of these CSS statements contains an error?



42. Which shorthand property can set width, style, and color of a border in one line?



43. How do you select an element with both classes “menu” and “active”?



44. Which property is used to repeat a background image vertically?



45. Which property changes the height of an element’s border?



46. How do you apply CSS to all <h1> and <h2> elements at once?



1. Which property adds a shadow to the element's box?



2. How do you select the first paragraph in a <div>?



3. Which of the following is the correct way to center text?



4. Which property is used to control the vertical spacing between lines of text?



Contents Copyrights Reserved By T4Tutorials