diff --git a/fetch/programmer-humour/index.html b/fetch/programmer-humour/index.html new file mode 100644 index 000000000..3bef16fa8 --- /dev/null +++ b/fetch/programmer-humour/index.html @@ -0,0 +1,14 @@ + + + + + + + Programmer Humour + + +

Programmer Humour

+ + + + diff --git a/fetch/programmer-humour/script.js b/fetch/programmer-humour/script.js new file mode 100644 index 000000000..80c904d7c --- /dev/null +++ b/fetch/programmer-humour/script.js @@ -0,0 +1,13 @@ +function getImage() { + fetch("https://xkcd.now.sh/?comic=latest") + .then((response) => response.json()) + .then((comicImages) => { + console.log(comicImages); + const comicImage = document.getElementById("comic-image"); + comicImage.src = comicImages.img; + }) + .catch((error) => { + console.log("Error fetching image:", error); + }); +} +getImage(); diff --git a/fetch/programmer-humour/style.css b/fetch/programmer-humour/style.css new file mode 100644 index 000000000..46180333d --- /dev/null +++ b/fetch/programmer-humour/style.css @@ -0,0 +1,20 @@ +body { + background-color: #fff0f5; + text-align: center; + padding: 40px; +} + +h1 { + color: #c85a8e; + font-family: "Brush Script MT", "Segoe Script", cursive; + font-size: 4rem; + margin-bottom: 50px; +} + +#comic-image { + display: block; + width: 1000px; + max-width: 90%; + margin: 0 auto 50px; + box-shadow: 0 8px 20px rgba(180, 80, 130, 0.2); +}