CSS Quiz

1. What does CSS stand for?





Answer: Cascading Style Sheets

2. What is the correct CSS syntax to change the background color of a page to blue?





Answer: background-color: blue;

3. Which CSS selector targets all p elements in a document?





Answer: p { }

4. How do you define a color using RGB in CSS?





Answer: rgb(255, 0, 0)

5. How do you add a solid black border with a width of 2px to an element?





Answer: border: 2px solid black;

6. What is the property used to create space outside an element?





Answer: margin

7. Which property is used to create space inside an element?





Answer: padding

8. How do you set the width of an element to 100px?





Answer: width: 100px;

9. Which property is part of the CSS box model and defines the space inside an element's border?





Answer: padding

21. How do you apply styles based on the screen size in CSS?





Answer: @media screen and (max-width: 600px) { }

11. How do you change the color of a link when hovered?





Answer: a:hover { color: red; }

12. How do you remove bullets from an unordered list?





Answer: list-style-type: none;

13. What does the CSS property display: none; do?





Answer: It hides the element.

14. Which CSS property is used to position an element relative to its normal position?





Answer: position: relative;

15. How do you make an element 50% transparent?





Answer: opacity: 0.5;

16. How do you create a dropdown menu in CSS?





Answer: position: absolute;

17. What is the default value of justify-content in Flexbox?





Answer: flex-start

18. Which property is used to create a CSS grid layout?





Answer: display: grid;

19. How do you create a navigation bar with CSS?