File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- <!DOCTYPE html>
1+ <!doctype html>
22< html lang ="en ">
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 >
10- < h1 > hello there</ h1 >
11- < p id ="quote "> </ p >
12- < p id ="author "> </ p >
13- < button type ="button " id ="new-quote "> New quote</ button >
11+ < div id ="quote-box ">
12+ < p id ="quote "> </ p >
13+ < p id ="author "> </ p >
14+ < button type ="button " id ="new-quote "> New quote</ button >
15+ </ div >
1416 </ body >
1517</ html >
Original file line number Diff line number Diff line change @@ -491,3 +491,17 @@ const quotes = [
491491] ;
492492
493493// call pickFromArray with the quotes array to check you get a random quote
494+ const quoteElement = document . querySelector ( "#quote" ) ;
495+ const authorElement = document . querySelector ( "#author" ) ;
496+ const newQuoteButton = document . querySelector ( "#new-quote" ) ;
497+
498+ function displayRandomQuote ( ) {
499+ const randomQuote = pickFromArray ( quotes ) ;
500+
501+ quoteElement . innerText = `"${ randomQuote . quote } "` ;
502+ authorElement . innerText = randomQuote . author ;
503+ }
504+
505+ displayRandomQuote ( ) ;
506+
507+ newQuoteButton . addEventListener ( "click" , displayRandomQuote ) ;
Original file line number Diff line number Diff line change 1- /** Write your CSS in here **/
1+ body {
2+ background-color : lavender;
3+ height : 100vh ;
4+ margin : 0 ;
5+ display : flex;
6+ justify-content : center;
7+ align-items : center;
8+ font-family : Arial, sans-serif;
9+ }
10+
11+ # quote-box {
12+ background-color : white;
13+ width : 500px ;
14+ max-width : 80% ;
15+ padding : 40px ;
16+ border-radius : 20px ;
17+ text-align : center;
18+ box-shadow : 0 5px 20px rgba (0 , 0 , 0 , 0.2 );
19+ }
20+
21+ # quote {
22+ font-size : 24px ;
23+ font-style : italic;
24+ color : # 333 ;
25+ margin-bottom : 20px ;
26+ }
27+
28+ # author {
29+ font-size : 18px ;
30+ color : # 777 ;
31+ margin-bottom : 30px ;
32+ }
33+
34+ button {
35+ background-color : lavender;
36+ border : none;
37+ padding : 12px 25px ;
38+ border-radius : 10px ;
39+ font-size : 16px ;
40+ cursor : pointer;
41+ }
42+
43+ button : hover {
44+ background-color : # d8b4fe ;
45+ }
You can’t perform that action at this time.
0 commit comments