freeCodeCamp/curriculum/challenges/english/01-responsive-web-design/basic-css-cafe-menu/part-026.md

84 lines
1.3 KiB
Markdown
Raw Normal View History

---
id: 5f356ed656a336993abd9f7c
title: Part 26
challengeType: 0
---
## Description
<section id='description'>
Next, you need to center the `div` element horizontally. This is accomplised by adding both a `margin-left` and `margin-right` property to the it and setting the value of both `auto`. You can think of a margin as invsible space around an element.
Using these margin properties, center the `div` element within the `body` element.
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: Test 1
testString: ''
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='html-seed'>
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Camper Cafe Menu</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div>
<header>
<h1>CAMPER CAFE</h1>
<p>Est. 2020</p>
</header>
<main>
<section>
<h2>Coffees</h2>
</section>
</main>
</div>
</body>
<html>
```
</div>
<div id='css-seed'>
```css
body {
/*
background-color: burlywood;
*/
}
h1, h2, p {
text-align: center;
}
--fcc-editable-region--
div {
width: 80%;
background-color: burlywood;
}
--fcc-editable-region--
```
</div>
</section>