1.9 KiB
1.9 KiB
id | title | challengeType | dashedName |
---|---|---|---|
5f356ed656a336993abd9f7c | Step 25 | 0 | step-25 |
--description--
Il prossimo passo è centrare div
orizzontalmente. Puoi farlo assegnando alle sue proprietà margin-left
e margin-right
il valore auto
. Pensa al margine come spazio invisibile attorno a un elemento. Utilizzando queste due proprietà dei margini, centra l'elemento div
all'interno dell'elemento body
.
--hints--
Dovresti assegnare alla proprietà margin-left
il valore auto
.
const hasMargin = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-left'] === 'auto');
assert(hasMargin);
Dovresti assegnare alla proprietà margin-right
il valore auto
.
const hasMargin = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['margin-right'] === 'auto');
assert(hasMargin);
Dovresti assegnare alle proprietà margin-left
e margin-right
di div
il valore auto
.
const divMarginRight = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('margin-right');
const divMarginLeft = new __helpers.CSSHelp(document).getStyle('div')?.getPropertyValue('margin-left');
assert(divMarginRight === 'auto');
assert(divMarginLeft === 'auto');
--seed--
--seed-contents--
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cafe Menu</title>
<link href="styles.css" rel="stylesheet"/>
</head>
<body>
<div>
<main>
<h1>CAMPER CAFE</h1>
<p>Est. 2020</p>
<section>
<h2>Coffee</h2>
</section>
</main>
</div>
</body>
</html>
body {
/*
background-color: burlywood;
*/
}
h1, h2, p {
text-align: center;
}
--fcc-editable-region--
div {
width: 80%;
background-color: burlywood;
}
--fcc-editable-region--