freeCodeCamp/curriculum/challenges/italian/14-responsive-web-design-22/learn-css-flexbox-by-buildi.../61539e07e7430b528fbffe21.md

105 lines
2.8 KiB
Markdown
Raw Normal View History

---
id: 61539e07e7430b528fbffe21
title: Step 16
challengeType: 0
dashedName: step-16
---
# --description--
Dai al selettore `.gallery` una proprietà `padding` impostata su `20px 10px` per creare spazio intorno al contenitore.
Poi, imposta `max-width` su `1400px` e aggiungi un `margin` con il valore `0 auto` per centrarlo.
# --hints--
Il selettore `.gallery` dovrebbe avere una proprietà `padding` con il valore `20px 10px`.
```js
assert.equal(new __helpers.CSSHelp(document).getStyle('.gallery')?.paddingTop, '20px');
assert.equal(new __helpers.CSSHelp(document).getStyle('.gallery')?.paddingBottom, '20px');
assert.equal(new __helpers.CSSHelp(document).getStyle('.gallery')?.paddingLeft, '10px');
assert.equal(new __helpers.CSSHelp(document).getStyle('.gallery')?.paddingRight, '10px');
```
Il selettore `.gallery` dovrebbe avere una proprietà `max-width` con il valore `1400px`.
```js
assert(new __helpers.CSSHelp(document).getStyle('.gallery')?.maxWidth === '1400px');
```
L'elemento `.gallery` dovrebbe essere centrato usando un `margin` con il valore `0 auto`.
```js
assert.include(new __helpers.CSSHelp(document).getStyle('.gallery').cssText, 'margin: 0px auto');
```
# --seed--
## --seed-contents--
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Photo Gallery</title>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<header class="header">
<h1>css flexbox photo gallery</h1>
</header>
<div class="gallery">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/1.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/2.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/3.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/4.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/5.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/6.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/7.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/8.jpg">
<img src="https://cdn.freecodecamp.org/curriculum/css-photo-gallery/9.jpg">
</div>
</body>
</html>
```
```css
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: sans-serif;
background: #f5f6f7;
}
.header {
text-align: center;
text-transform: uppercase;
padding: 32px;
background-color: #0a0a23;
color: #fff;
border-bottom: 4px solid #fdb347;
}
--fcc-editable-region--
.gallery {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
--fcc-editable-region--
.gallery img {
width: 100%;
max-width: 350px;
height: 300px;
}
```