Week 5 Flashcards
Covers all content taught in week 5 (41 cards)
What is the primary original use of the float property in CSS?
Wrapping text around images or similar inline elements.
What happens when an element is floated?
It is removed from the normal document flow.
How can you prevent content from wrapping around a floated element?
Use clear: left, right, or both.
Is float recommended for layout today?
No, it’s outdated for layout; use Flexbox or Grid instead.
What type of layout is Flexbox best suited for?
One-dimensional layouts (row OR column).
How do you enable Flexbox on a container?
display: flex
What property controls the direction of Flexbox items?
flex-direction
What does justify-content control?
Main axis alignment (left, center, space-between, etc.)
What does align-items control?
Cross axis alignment (top, center, stretch, etc.)
What type of layout is CSS Grid best suited for?
Two-dimensional layouts (rows and columns).
How do you enable CSS Grid?
display: grid
How do you define column sizes in a grid?
With grid-template-columns, e.g. 1fr 2fr
How do you place a grid item in a specific cell?
Use grid-row and grid-column.
What is a fixed layout?
A layout with a set pixel width that doesn’t adapt to screen size.
What is a fluid layout?
A layout that uses percentages and stretches/shrinks with screen size
What is an elastic layout?
A layout that uses relative units like em or rem and scales with font size.
What is a responsive layout?
A layout that adapts to any screen using relative units and media queries.
What is an adaptive layout?
A layout that switches between predefined fixed layouts at breakpoints.
What is the purpose of responsive design?
To ensure websites work well on all screen sizes.
What meta tag is essential for responsive design?
<meta></meta>
How do you write a media query for max width 768px?
@media (max-width: 768px) { … }
What are common screen size breakpoints for media queries?
Mobile: ≤ 480px
Tablet: 481–768px
Desktop: 769–1200px+
How do you neatly space elements in a footer using Flexbox?
Use display: flex on the footer container with justify-content: space-between to spread items evenly—perfect for placing contact info on one side and links/copyright on the other.
How can you create a responsive navigation bar with Flexbox?
Use flex-direction: row for desktops and switch to column with media queries for mobile devices. This stacks menu items vertically on smaller screens.