File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 < head >
44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
6- < title > Title here</ title >
6+ < title > Quote generator app</ title >
7+ < link rel ="stylesheet " href ="style.css ">
78 < script defer src ="quotes.js "> </ script >
89 </ head >
910 < body >
Original file line number Diff line number Diff line change @@ -491,3 +491,18 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+
495+ function displayRandomQuote ( ) {
496+ const randomQuote = pickFromArray ( quotes ) ;
497+
498+ document . getElementById ( "quote" ) . textContent = randomQuote . quote ;
499+ document . getElementById ( "author" ) . textContent = randomQuote . author ;
500+ }
501+
502+ // run when page loads2
503+ displayRandomQuote ( ) ;
504+
505+ // button click
506+ document
507+ . getElementById ( "new-quote" )
508+ . addEventListener ( "click" , displayRandomQuote ) ;
Original file line number Diff line number Diff line change 11/** Write your CSS in here **/
2+ body {
3+ font-family : Arial, sans-serif;
4+ background-color : # f4f4f4 ;
5+ text-align : center;
6+ padding : 50px ;
7+ }
8+
9+ h1 {
10+ color : # 333 ;
11+ }
12+
13+ # quote {
14+ font-size : 1.5rem ;
15+ margin : 20px 0 ;
16+ color : # 222 ;
17+ }
18+
19+ # author {
20+ font-size : 1.2rem ;
21+ color : # 666 ;
22+ margin-bottom : 30px ;
23+ }
24+
25+ button {
26+ padding : 10px 20px ;
27+ font-size : 1rem ;
28+ background-color : # 007BFF ;
29+ color : white;
30+ border : none;
31+ border-radius : 5px ;
32+ cursor : pointer;
33+ }
34+
35+ button : hover {
36+ background-color : # 0056b3 ;
37+ }
You can’t perform that action at this time.
0 commit comments