2020-09-03 19:12:42 -07:00
|
|
|
---
|
|
|
|
id: 5f344f9c805cd193c33d829c
|
2021-10-21 10:07:52 -07:00
|
|
|
title: Step 12
|
2020-09-03 19:12:42 -07:00
|
|
|
challengeType: 0
|
2021-10-21 10:07:52 -07:00
|
|
|
dashedName: step-12
|
2020-09-03 19:12:42 -07:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2020-10-13 15:27:40 -07:00
|
|
|
You can add style to an element by specifying it in the `style` element and setting a property for it like this:
|
2020-09-03 19:12:42 -07:00
|
|
|
|
|
|
|
```css
|
2020-10-13 15:27:40 -07:00
|
|
|
element {
|
|
|
|
property: value;
|
2020-09-03 19:12:42 -07:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-10-13 15:27:40 -07:00
|
|
|
Center your `h1` element by setting its `text-align` property to the value `center`.
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2021-07-21 12:03:09 -07:00
|
|
|
You should have an `h1` selector in your `style` element.
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-21 12:03:09 -07:00
|
|
|
const hasSelector = new __helpers.CSSHelp(document).getStyle('h1');
|
|
|
|
assert(hasSelector);
|
|
|
|
```
|
|
|
|
|
|
|
|
Your `text-align` property should set a value of `center`.
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2021-07-21 12:03:09 -07:00
|
|
|
```js
|
|
|
|
const hasTextAlign = new __helpers.CSSHelp(document).getCSSRules().some(x => x.style['text-align'] === 'center');
|
|
|
|
assert(hasTextAlign);
|
|
|
|
```
|
|
|
|
|
|
|
|
Your `h1` selector should set the `text-align` property to `center`.
|
|
|
|
|
|
|
|
```js
|
|
|
|
const h1TextAlign = new __helpers.CSSHelp(document).getStyle('h1')?.getPropertyValue('text-align');
|
|
|
|
assert(h1TextAlign === 'center');
|
2020-09-03 19:12:42 -07:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2020-09-03 19:12:42 -07:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2020-09-03 19:12:42 -07:00
|
|
|
|
|
|
|
```html
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2022-03-14 15:54:43 +00:00
|
|
|
<title>Cafe Menu</title>
|
2020-11-27 19:02:05 +01:00
|
|
|
--fcc-editable-region--
|
2020-09-03 19:12:42 -07:00
|
|
|
<style>
|
|
|
|
</style>
|
2020-11-27 19:02:05 +01:00
|
|
|
--fcc-editable-region--
|
2020-09-03 19:12:42 -07:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<h1>CAMPER CAFE</h1>
|
|
|
|
<p>Est. 2020</p>
|
|
|
|
</header>
|
|
|
|
<main>
|
|
|
|
<section>
|
2021-07-21 12:03:09 -07:00
|
|
|
<h2>Coffee</h2>
|
2020-09-03 19:12:42 -07:00
|
|
|
</section>
|
|
|
|
</main>
|
|
|
|
</body>
|
|
|
|
<html>
|
|
|
|
```
|
|
|
|
|