DEV Community

Robson Muniz
Robson Muniz

Posted on

🎬Make a Joke Generator | HTML, CSS & javaScript🙌

Make a Make a Joke Generator | HTML, CSS & javaScript, step-by-step from SCRATCH…



Source Code:

HTML

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Joke Generator</title>
  <link rel="stylesheet" href="style.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>

<body>
  <div class="main_container">
    <h3>Try Not To Laugh Challenge</h3>
    <div class="joke" id="₢">
      Here goes the joke!
    </div>
    <button class="btn" id="₢">
      Get Another Joke
      <i class="fas fa-grin-squint-tears"></i>
    </button>
  </div>
  <script src="app.js"></script>

</body>

</html>
Enter fullscreen mode Exit fullscreen mode

CSS

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    background: url(img/bg.jpg) center center/cover no-repeat;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.main_container {
    background-color: #f6f1f4;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1);
    padding: 50px 20px;
    max-width: 100%;
    width: 800px;
    text-align: center;
}

h3 {
    margin: 0;
    letter-spacing: 2px;
    opacity: 0.5;
}

.joke {
    font-size: 30px;
    color: #16110d;
    line-height: 40px;
    margin: 50px auto;
    max-width: 600px;
}
.btn {
    background-color: #9f68e0;
    border: 0;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 6px 6px rgba(0, 0, 0, 0.1);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    padding: 14px 40px;
}

.btn:active {
    transform: scale(.98);
}
.fas {
    margin-left: 4px;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)