Q: What does CSS stand for?
A: Cascading Style Sheets — a language used to describe how HTML elements should be displayed.
Q: What is the main purpose of CSS?
A: To separate presentation and design from HTML structure and content.
Q: Who created CSS?
A: The World Wide Web Consortium (W3C).
Q: Why separate structure (HTML) and presentation (CSS)?
A: It improves modularity, reusability, and maintainability of web pages.
Q: What is a stylesheet?
A: A document or section containing CSS rules that define how HTML elements are styled.
Q: How do you link a CSS file to an HTML document?
A: <link></link>
Q: What is the basic syntax of a CSS rule?
A: selector { property: value; }
Q: What is a selector in CSS?
A: The part of a rule that identifies which HTML elements the style applies to.
Q: What is a property in CSS?
A: The visual aspect you want to style, such as color, font-size, or margin.
Q: What is a value in CSS?
A: The setting for the property, e.g., color: red; font-size: 16px;
Q: Example of a CSS rule:
A: The setting for the property, e.g., color: red; font-size: 16px;
Q: Example of a CSS rule:
A: p { color: blue; font-size: 16px; }
Q: What file extension do CSS files use?
A: .css
Q: What are the three main ways to apply CSS?
A: Inline styles, document-level (internal) styles, and external stylesheets.
Q: Which method of applying CSS is preferred?
A: External stylesheets — they can be reused across multiple pages.
Q: What type of styling do browsers apply if no CSS is used?
A: Default user-agent styles (built-in browser formatting).
Q: What does the term “cascading” refer to in CSS?
A: The order of priority that determines which styles take effect when multiple rules apply.
Q: Why is CSS important?
A: It controls layout, colors, fonts, and spacing, creating visually appealing and consistent web pages.
Q: What symbol is used to end a CSS declaration?
A: A semicolon ( ; )
Q: What must all property-value pairs be enclosed in?
A: Curly braces { }
Q: What is a type (element) selector?
A: Targets all elements of a given type, e.g. p { color: blue; }
Q: What does a class selector do?
A: Targets all elements with a specific class attribute: .menu { color: red; }
Q: How is a class applied in HTML?
A: <p class="menu">Item</p>
Q: What does an id selector do?
A: Targets the element with a specific id: #header { background: gray; }