Thursday, September 25, 2025

8 years code

Day 1 – How to Make My First Webpage (HTML)

How to:

  1. Open your code editor (Notepad or any editor).

  2. Write your HTML structure: <html>, <head>, <body>.

  3. Add a title inside <head>: <title>My First Webpage</title>.

  4. Add your name as a heading: <h1>Hello, my name is Ada</h1>.

  5. Add paragraphs for age and favorite food: <p>I am 9 years old.</p>

  6. Save the file as day1.html and open it in a browser.

<!DOCTYPE html>
<html>
<head>
  <title>My First Webpage</title>
</head>
<body>
  <h1>Hello, my name is Ada</h1>
  <p>I am 9 years old.</p>
  <p>My favorite food is rice and chicken.</p>
</body>
</html>

Day 2 – How to Add Pictures & Lists (HTML)

How to:

  1. Start a new HTML file.

  2. Add a heading: <h1>My Favorite Animals</h1>.

  3. Create a list using <ul> and <li> for animals.

  4. Add a picture of one animal using <img src="link" alt="description">.

  5. Save and open it to see your list and picture.

<!DOCTYPE html>
<html>
<head>
  <title>My Favorite Animals</title>
</head>
<body>
  <h1>My Favorite Animals</h1>
  <ul>
    <li>Dog</li>
    <li>Cat</li>
    <li>Elephant</li>
  </ul>
  <img src="https://place-puppy.com/200x200" alt="Cute Puppy">
</body>
</html>

Day 3 – How to Color Text (CSS)

How to:

  1. Open a new HTML file.

  2. Add <style> inside <head> to write CSS.

  3. Change the heading color and size: h1 { color: blue; font-size: 50px; }.

  4. Change paragraph color and background: p { color: green; background-color: yellow; }.

  5. Add your heading and paragraph inside <body>.

<!DOCTYPE html>
<html>
<head>
  <title>Colorful Name</title>
  <style>
    h1 { color: blue; font-size: 50px; }
    p { color: green; background-color: yellow; }
  </style>
</head>
<body>
  <h1>My Name is Ada</h1>
  <p>I love learning coding!</p>
</body>
</html>

Day 4 – How to Decorate a Picture (CSS)

How to:

  1. Add a picture using <img src="link">.

  2. Inside <style>, add CSS:

    • border: 5px solid red; → red border

    • border-radius: 15px; → rounded corners

    • padding: 10px; → space around picture

  3. Center everything using body { text-align: center; }.

<!DOCTYPE html>
<html>
<head>
  <title>Decorated Picture</title>
  <style>
    img {
      border: 5px solid red;
      border-radius: 15px;
      padding: 10px;
    }
    body { text-align: center; }
  </style>
</head>
<body>
  <h1>This is me!</h1>
  <img src="https://placekitten.com/200/200" alt="Kitten">
</body>
</html>

Day 5 – How to Make a Button Pop Up a Message (JS)

How to:

  1. Add a button with <button onclick="sayHello()">Click Me</button>.

  2. Write a <script> inside <body> or <head>.

  3. Create a function: function sayHello() { alert("Hello!"); }.

  4. Save and click the button to see the message.

<!DOCTYPE html>
<html>
<head>
  <title>Button Example</title>
  <style>
    button { font-size: 20px; padding: 10px; background-color: lightblue; }
  </style>
</head>
<body>
  <h1>Click the Button!</h1>
  <button onclick="sayHello()">Click Me</button>

  <script>
    function sayHello() {
      alert("Hello, I am learning coding!");
    }
  </script>
</body>
</html>

Day 6 – How to Change Background Color (JS)

How to:

  1. Add a button: <button onclick="changeColor()">Change Color</button>.

  2. Inside <script> write:

function changeColor() {
  document.body.style.backgroundColor = "lightgreen";
}
  1. Add CSS to style the button.

  2. Save and click to change the page background.

<!DOCTYPE html>
<html>
<head>
  <title>Background Color Changer</title>
  <style>
    button { font-size: 18px; padding: 10px; background-color: yellow; }
  </style>
</head>
<body>
  <h1>Click to Change Background</h1>
  <button onclick="changeColor()">Change Color</button>

  <script>
    function changeColor() {
      document.body.style.backgroundColor = "lightgreen";
    }
  </script>
</body>
</html>

Day 7 – How to Make a Click Counter Game (JS)

How to:

  1. Create a <span id="count">0</span> to show clicks.

  2. Add a button with onclick="addClick()".

  3. Inside <script> write:

let count = 0;
function addClick() {
  count = count + 1;
  document.getElementById("count").innerText = count;
}
  1. Style the button and counter using <style>.

<!DOCTYPE html>
<html>
<head>
  <title>Click Counter</title>
  <style>
    button { font-size: 20px; padding: 10px; background-color: pink; }
    span { font-weight: bold; font-size: 25px; color: red; }
  </style>
</head>
<body>
  <h1>Click the Button!</h1>
  <p>Clicks: <span id="count">0</span></p>
  <button onclick="addClick()">Click Me</button>

  <script>
    let count = 0;
    function addClick() {
      count = count + 1;
      document.getElementById("count").innerText = count;
    }
  </script>
</body>
</html>

Day 8 – How to Make a Mini Quiz Game (JS)

How to:

  1. Add a button: <button onclick="startQuiz()">Start Quiz</button>.

  2. Inside <script> write a function:

function startQuiz() {
  let answer = prompt("What is 2 + 2?");
  if(answer == "4") {
    alert("Correct!");
  } else {
    alert("Try again!");
  }
}
  1. Style the button in <style>.

  2. Save and click to play the quiz.

<!DOCTYPE html>
<html>
<head>
  <title>Mini Quiz</title>
  <style>
    button { font-size: 20px; padding: 10px; background-color: orange; }
  </style>
</head>
<body>
  <h1>Mini Quiz</h1>
  <button onclick="startQuiz()">Start Quiz</button>

  <script>
    function startQuiz() {
      let answer = prompt("What is 2 + 2?");
      if(answer == "4") {
        alert("Correct!");
      } else {
        alert("Try again!");
      }
    }
  </script>
</body>
</html

0 comments:

Post a Comment

 

BEST COMPUTER GUIDE Written by Abigail Odenigbo, Published @ 2014 by NOBIGDEAL(Ipietoon)