diff --git a/fetch/programmer-humour/index.html b/fetch/programmer-humour/index.html new file mode 100644 index 00000000..46f4ad9e --- /dev/null +++ b/fetch/programmer-humour/index.html @@ -0,0 +1,16 @@ + + + + + + Programmer Humour + + + + +

Comic

+
+

+ + + \ No newline at end of file diff --git a/fetch/programmer-humour/script.js b/fetch/programmer-humour/script.js new file mode 100644 index 00000000..8137fe07 --- /dev/null +++ b/fetch/programmer-humour/script.js @@ -0,0 +1,14 @@ +function getComic() { + fetch("https://xkcd.now.sh/?comic=latest") + .then((res) => res.json()) + .then((data) => { + console.log(data); + document.getElementById("comic-container").innerHTML = + ``; + }) + .catch(() => { + document.getElementById("error-message").textContent = + "Error loading comic"; + }); +} +getComic(); diff --git a/fetch/programmer-humour/style.css b/fetch/programmer-humour/style.css new file mode 100644 index 00000000..2ea2118c --- /dev/null +++ b/fetch/programmer-humour/style.css @@ -0,0 +1,20 @@ +body { + text-align: centre; + font-family: Arial, sans-serif; +} + +img { + max-width: 100%; + background-color: rgb(174, 130, 217); + padding: 10%; + display: block; +} +h1{ + text-align: center; + font-family: 'Courier New', Courier, monospace; + background-color: blanchedalmond; +} +img { + display: block; + margin: 0 auto; +} \ No newline at end of file