CSS Flashcards
What does CSS stand for?
Cascading Style Sheets
What is the purpose of CSS?
To specify styles for how HTML elements should be displayed.
What is the basic structure of a CSS rule?
selector { property: value; }
What are the three ways to apply CSS to an HTML document?
Inline styles (using the style attribute)
Document-level styles (using <style> in the head)</style>
External stylesheets (using <link></link>)
What is an element selector in CSS?
A selector that targets HTML elements by their tag name (e.g., p { color: red; })
What is a class selector in CSS?
A selector that targets elements with a specific class attribute (e.g., .menu-item { color: blue; })
What is an ID selector in CSS?
A selector that targets a unique element with a specific ID attribute (e.g., #mainheading { font-size: 24px; })
What is the universal selector in CSS?
*, which targets all elements
How do you combine multiple selectors in CSS?
Separate them with commas (e.g., h1, h2, h3 { color: green; })
What is the priority order for CSS rules?
Inline styles > document-level/external styles > browser defaults
How do you write a comment in CSS?
/* This is a comment */
What is the purpose of the font-family property?
To specify the font for text (e.g., font-family: Arial, sans-serif;)
What is the purpose of the margin property?
To specify the space outside an element’s border
What is the purpose of the padding property?
To specify the space inside an element’s border, around its content.
What is the text-align property used for?
To align text horizontally (e.g., text-align: center;).
What are SASS and SCSS?
Preprocessors that extend CSS with features like variables, nesting, and mixins, which are compiled into standard CSS