Flashcards · HTML & CSS · Free
HTML & CSS flashcards, generated for you.
Example HTML & CSS study cards to learn from right now — then generate a full set from your own notes (plus a practice quiz) and export to Quizlet or Anki. Free, no account needed.
Example HTML & CSS flashcards
What is the correct syntax for an HTML5 DOCTYPE declaration?
<!DOCTYPE html> — all lowercase, no version number. This must be the first line of any HTML5 document.
What is the difference between a block element and an inline element?
Block elements (div, p, h1) take full width, start on new lines, and respect margin/padding on all sides. Inline elements (span, a, strong) flow within text, only respect left/right margin/padding, and ignore top/bottom.
Why doesn't setting height work on an inline element?
Inline elements have their height determined by line-height and font-size, not the height property. Use display: inline-block or display: block to set explicit height.
What does the CSS box model include, in order from inside out?
Content → Padding → Border → Margin. The width/height property applies only to content; use box-sizing: border-box to include padding and border in the width calculation.
What is CSS specificity, and which selector has the highest specificity?
Specificity determines which rule wins when styles conflict. Order (lowest to highest): element < class/attribute < ID < inline style. Use !important as last resort (lowest priority in maintainability).
Why might a CSS rule not apply to an element even though the selector looks correct?
Common causes: (1) another rule has higher specificity, (2) selector is too broad/narrow, (3) CSS is overridden by inline styles or !important, (4) property doesn't apply to that element type (e.g., margin on inline), (5) typo in property name.
What is the difference between margin: auto and margin: 0 auto?
margin: 0 auto sets top/bottom margin to 0 and left/right to auto (centers block horizontally). margin: auto sets all four sides to auto (centers both horizontally and vertically on flex/grid containers).
What is the CSS float property, and why is it considered outdated?
Float removes an element from normal flow and wraps text around it (originally for magazine layouts). It's outdated because flexbox and CSS Grid handle layout better, more intuitively, and without the side effects of float-based clearfix hacks.
What is the difference between position: relative, absolute, and fixed?
relative: positioned relative to its normal position, still takes up space. absolute: removed from flow, positioned relative to nearest positioned ancestor. fixed: removed from flow, positioned relative to viewport (stays put on scroll).
Why should you avoid inline styles in HTML, and what is the cascade rule?
Inline styles (style attribute) are hard to override and violate separation of concerns. The cascade rule: browser defaults → external/internal CSS → inline styles → !important (opposite of normal priority). Use classes instead for maintainability.
Make your own HTML & CSS study set
Flashcards for related topics
Studying HTML & CSS to build with AI? MindloomHQ turns it into real skills — structured courses, agent projects, and certificates.
Explore MindloomHQ →