CSS & HTML Flashcards
(49 cards)
What does CSS stand for?
Cascading Style Sheets
What is the primary purpose of CSS?
To style and lay out web pages
What is an external stylesheet?
A separate file with a .css extension that contains CSS
How do you link an external CSS stylesheet in HTML?
<link></link>
What is an internal stylesheet?
CSS placed within a <style> element inside the HTML <head></style>
What are inline styles?
CSS declarations that affect a single HTML element within a style attribute
True or False: Inline CSS is generally recommended for maintaining styles across multiple pages.
False
What is a class in CSS?
A way to group HTML elements and apply the same styles to them
How do you select elements by class in CSS?
Use a full stop before the class name (e.g., .special)
What is a descendant combinator in CSS?
A selector that targets elements based on their location within another element, using a space between selectors
What does the next-sibling combinator do?
Selects an element that is directly after a specified element, using a + between selectors
How do you style links in different states using CSS?
Using pseudo-classes like a:link, a:visited, and a:hover
What is specificity in CSS?
A set of rules that determines which CSS styles apply when selectors conflict
What does the calc() function do in CSS?
Performs simple math with values
What are CSS @rules?
Special rules that provide instructions for CSS behavior
Provide an example of a CSS shorthand property.
padding, margin, font, background, border
What are the two types of boxes in CSS?
Block and inline
What is the outer display type of a block box?
The box breaks onto a new line and respects width and height properties
How does an inline box behave?
It does not break onto a new line and width and height properties do not apply
What does the display property control?
The outer and inner display types of a box
What is the purpose of the @media rule in CSS?
To create media queries for responsive layouts
What is the significance of the cascade in CSS?
It determines which styles apply when multiple rules conflict based on their order
What does the shorthand property padding: 10px 15px 15px 5px; represent?
Top: 10px, Right: 15px, Bottom: 15px, Left: 5px
What does the inner display type dictate?
How elements inside a box are laid out
element that directly follows an
element
- element use when set to display: inline-flex?