CSS - Set 1

CSS Question & Answer Practice

CSS Practice – Questions & Answers

Beginner Level

Q1. What is CSS?

Answer: CSS stands for Cascading Style Sheets. It is used to style HTML elements.

Q2. Which tag is used to write internal CSS?

Answer: <style>

Q3. Write syntax of CSS.
selector {
  property: value;
}
Q4. How do you change text color?
p { color: red; }
Q5. Which property changes background color?

Answer: background-color

Intermediate Level

Q6. Difference between class and id?

Answer: Class can be reused; id must be unique.

Q7. How to select multiple elements?
h1, h2, p {
  color: blue;
}
Q8. What is box model?

Answer: Content, padding, border, margin.

Q9. How to add border?
div {
  border: 1px solid black;
}
Q10. How to hide an element?
display: none;

Advanced Level

Q11. What is Flexbox?

Answer: A layout method for aligning items in rows or columns.

Q12. Center items using Flexbox.
display: flex;
justify-content: center;
align-items: center;
Q13. What is z-index?

Answer: Controls element stacking order.

Q14. What is responsive design?

Answer: Design that adapts to screen sizes.

Q15. Media query example.
@media (max-width:600px) {
  body { background: lightgray; }
}

No comments:

Post a Comment