CSS Flashcards
(10 cards)
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 are the three ways to apply CSS to an HTML document?
Inline styles applied directly to HTML elements using style attribute
(e.g.<p style="color: blue; ">)
used for temporary fixes
Document-level styles defined in the <style> tag in HTML documents
(e.g. <style>)
Applied to the entire document</style></style>
External stylesheets defined in seperate .css file and linked to HTML documents using <link></link> tag
(e.g. <link></link>
Applied to multiple pages making it reusable
What is an element selector in CSS?
selector targets elements by tag name (e.g., p { color: red; })
What is a class selector in CSS?
selector targets elements with specific class attribute (e.g., .menu-item { color: blue; })
What is an ID selector in CSS?
selector targets unique element with 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; })
use for style sheets
separate content from presentation.
allows for consistent styling across multiple pages, allows change to appearance without changing content, and easy to maintain
cascading
how styles are applied to HTML elements based on a hierarchy of priority rules (source order, specify, importance)