mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-31 18:01:36 -04:00
fix(curriculum): Update code example for style.display explanation in RPG game (#53440)
This commit is contained in:
@@ -7,12 +7,19 @@ dashedName: step-116
|
||||
|
||||
# --description--
|
||||
|
||||
The HTML element that shows the monster's stats has been hidden with CSS. Display the `monsterStats` element by updating the `display` property of the `style` property to `block`. For example, updating the `first` property of the `name` property of `user` would look like:
|
||||
By default, the HTML element that shows the monster's stats has been hidden with CSS. When the player clicks the "Fight dragon" button, the monster's stats should be displayed. You can accomplish this by using the <dfn>style</dfn> and <dfn>display</dfn> properties on the `monsterStats` element.
|
||||
|
||||
The `style` property is used to access the inline style of an element and the `display` property is used to set the visibility of an element.
|
||||
|
||||
Here is an example of how to update the display for a paragraph element:
|
||||
|
||||
```js
|
||||
user.name.first = "Naomi";
|
||||
const paragraph = document.querySelector('p');
|
||||
paragraph.style.display = 'block';
|
||||
```
|
||||
|
||||
Display the `monsterStats` element by updating the `display` property of the `style` property to `block`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should use dot notation to access the `style` property of `monsterStats`.
|
||||
|
||||
Reference in New Issue
Block a user