|
9 | 9 | 5. See HTML |
10 | 10 | 6. Create a new img element and set its src attribute to a picture of you.Append that element to the page. |
11 | 11 | */ |
| 12 | + |
12 | 13 | 'use strict'; |
| 14 | + |
13 | 15 | // add a font family to the body |
14 | 16 | document.body.style.fontFamily = 'arial, sans-serif'; |
15 | 17 |
|
16 | 18 | // select the spans by their ID's and add text to them |
| 19 | +const ulElement = document.getElementById('ulElement'); |
| 20 | +ulElement.style.background = 'red'; |
| 21 | +ulElement.style.borderRadius = '5px'; |
| 22 | +ulElement.style.width = 'calc(100% - 400px)'; |
| 23 | +ulElement.style.margin = '0 auto'; |
17 | 24 | const nickName = document.getElementById('nickname'); |
18 | 25 | nickName.textContent = 'Don'; |
19 | 26 | const favFood = document.getElementById('fav-food'); |
20 | 27 | favFood.textContent = 'Fish'; |
21 | 28 | const homeTown = document.getElementById('hometown'); |
22 | 29 | homeTown.textContent = 'Asmara, Eritrea'; |
23 | | -const liElement = document.querySelectorAll('li'); |
| 30 | +const liElements = document.querySelectorAll('li'); |
| 31 | +// liElements.style.listStyleType = 'none'; |
24 | 32 |
|
25 | | -//loop through the li's and add them a class name |
26 | | -for (let i = 0; i < liElement.length; i++) { |
27 | | - liElement[i].className = 'list-item'; |
| 33 | +// loop through the li's and add them a class name |
| 34 | +for (let i = 0; i < liElements.length; i++) { |
| 35 | + liElements[i].className = 'list-item'; |
| 36 | + liElements[i].style.listStyleType = 'none'; |
| 37 | + liElements[i].style.fontSize = '1.5rem'; |
| 38 | + liElements[i].style.padding = '0.8rem'; |
28 | 39 | } |
29 | 40 | const myPhoto = document.createElement('img'); |
30 | | -myPhoto.src = 'photo.jpg'; //add photo source |
31 | | -document.body.appendChild(myPhoto); //append photo to the page |
| 41 | +myPhoto.src = 'photo.jpg'; // add photo source |
| 42 | +myPhoto.style.display = 'block'; |
| 43 | +myPhoto.style.borderRadius = '50%'; |
| 44 | +myPhoto.style.width = '18.75rem'; |
| 45 | +myPhoto.style.margin = '0 auto'; |
| 46 | +document.body.appendChild(myPhoto); // append photo to the page |
0 commit comments