` elements, each holding an `
![]()
` and possibly a description. [S1]
**Example 1 β Basic Image Gallery**
The gallery container is a flex row that wraps; each item has a `5px` margin, a `1px` border (darkening on hover), and a fixed `180px` width. Images fill the item width, and the `.desc` caption is padded and centered: [S1]
```html
Cinque Terre
Green Forest
Northern Lights
Mountains
```
**Tip:** `display: flex;` is used for the image gallery above. This layout module is effective for arranging images in rows or columns. [S1]
**Example 2 β Responsive Image Gallery**
Adds `box-sizing: border-box` globally and uses percentage widths via `calc()`. Media queries re-arrange the images per the rule set: larger than 768px shows four side by side, smaller than 768px shows two, and smaller than 480px stacks them vertically (100%): [S1]
```html
Responsive Image Gallery
Resize the browser window to see the effect!
Cinque Terre
Green Forest
Northern Lights
Mountains
```
Media-query rules summarized on the page: if the screen is larger than 768px wide, show four images side by side; if smaller than 768px, show two side by side; if smaller than 480px, stack the images vertically (100%). **Tip:** You will learn more about media queries later in the CSS Tutorial. [S1]
## π οΈ μ μ© μ¬λ‘ (Applied in summary)
The page's two examples β a fixed-width flex gallery and a responsive percentage-width gallery β are the applied demonstrations. No external project/commit applications found in the source.
## π» μ½λ ν¨ν΄ (Code patterns)
Flex-wrap gallery container (language: CSS):
```css
div.gallery {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}
div.gallery-item img {
width: 100%;
height: auto;
}
```
Responsive breakpoint width swap (language: CSS):
```css
div.gallery-item { width: calc(25% - 20px); }
@media only screen and (max-width: 768px) {
div.gallery-item { width: calc(50% - 20px); }
}
@media only screen and (max-width: 480px) {
div.gallery-item { width: calc(100% - 20px); }
}
```
## βοΈ λͺ¨μ λ° μ
λ°μ΄νΈ (Contradictions & updates)
No contradictions found in the source.
## β
κ²μ¦ μν λ° μ λ’°λ
- **μν:** draft
- **κ²μ¦ λ¨κ³:** conceptual (μ€μ μ μ© μ¬λ‘ λ°κ²¬ μ applied/validatedλ‘ μΉκ²© κ°λ₯)
- **μΆμ² μ λ’°λ:** B (W3Schools β widely used educational reference, not a primary standards body)
- **μ λ’° μ μ:** 0.89
- **μ€λ³΅ κ²μ¬ κ²°κ³Ό:** μ κ· μμ± (New discovery)
## π μ§μ κ·Έλν (Knowledge Graph)
- **μμ/루νΈ:** [[CSS Tutorial]]
- **κ΄λ ¨ κ°λ
:** [[CSS Flexbox]], [[CSS Media Queries]], [[CSS Image Sprites]]
- **μ°Έμ‘° λ§₯λ½:** Referenced when laying out collections of images responsively, such as portfolios or product grids.
## π μΆμ² (Sources)
- [S1] W3Schools β CSS Image Gallery β https://www.w3schools.com/css/css_image_gallery.asp
## π λ³κ²½ μ΄λ ₯ (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "CSS Image Gallery" page (Astra wiki-curation, P-Reinforce v3.1 format).