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 href ="style.css " rel ="stylesheet " />
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 class ="container ">
12+ < h1 > Get inspired by the Quote Generator</ h1 >
13+
14+ < div class ="quotebox ">
15+ < p id ="quote "> </ p >
16+ < p id ="author "> </ p >
17+ </ div >
18+
19+ < button type ="button " id ="new-quote "> New quote</ button >
20+ </ div >
1421 </ body >
1522</ html >
Original file line number Diff line number Diff line change 1+ const quoteP = document . querySelector ( "#quote" ) ;
2+ const authorP = document . querySelector ( "#author" ) ;
3+ const newQuoteButton = document . querySelector ( "#new-quote" ) ;
4+
5+ function displayQuote ( ) {
6+ const randomQuote = pickFromArray ( quotes ) ;
7+ quoteP . textContent = randomQuote . quote ;
8+ authorP . textContent = `- ${ randomQuote . author } ` ;
9+ }
10+
11+ window . onload = function ( ) {
12+ displayQuote ( ) ;
13+ } ;
14+
15+ newQuoteButton . addEventListener ( "click" , displayQuote ) ;
16+
117// DO NOT EDIT BELOW HERE
218
319// pickFromArray is a function which will return one item, at
@@ -23,7 +39,7 @@ function pickFromArray(choices) {
2339// A list of quotes you can use in your app.
2440// DO NOT modify this array, otherwise the tests may break!
2541const quotes = [
26- {
42+ {
2743 quote : "Life isn't about getting and having, it's about giving and being." ,
2844 author : "Kevin Kruse" ,
2945 } ,
@@ -491,3 +507,4 @@ const quotes = [
491507] ;
492508
493509// call pickFromArray with the quotes array to check you get a random quote
510+ pickFromArray ( quotes ) ;
Original file line number Diff line number Diff line change 1- /** Write your CSS in here **/
1+ body {
2+ background-color : rgb (13 , 13 , 50 );
3+ color : rgb (250 , 200 , 135 );
4+ font-family : 'Trebuchet MS' , 'Verdana' , Arial, sans-serif;
5+ text-align : center;
6+ justify-content : center;
7+ display : flex;
8+ }
9+
10+ .quotebox {
11+ position : relative;
12+ width : 70% ;
13+ background : rgb (250 , 200 , 135 );
14+ color : rgb (13 , 13 , 50 );
15+ display : flex;
16+ flex-direction : column;
17+ align-items : center;
18+ padding : 20px ;
19+ }
20+
21+ .container {
22+ display : flex;
23+ flex-direction : column;
24+ align-items : center;
25+ justify-content : center;
26+ }
You can’t perform that action at this time.
0 commit comments