<!DOCTYPE html>
<html lang="pt-Br">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Hora do Dia</title>
    <link rel="stylesheet" href="estilo.css">
</head>
<body onload ="carregar()">
<header>
<h1> Hora do Dia </h1>
</header>
<section>
    <div id="msg">
        Aqui vai aparecer a mensagem....
    </div>
    <div id="imagem"> 
        <img id="imagem" src="manha.png" alt="Foto do Dia">
    </div>
</section>
<footer>
    <p>&copy; CursoemVideo </p>
</footer>
<script src = "modelo.js">  </script>
</body>
</html>
body{
    background: rgb(30, 30, 233);
    font: normal 15pt Arial;
}

header{
    color: white;
    text-align: center;

}

section{
    background: white;
    border-radius: 10px;
    padding: 15px;
    width: 500px;
    margin: auto;
    box-shadow: 3px 3px 10px rgba(0, 0 , 0, 363);
}

div{
    text-align: center;
    padding: 8px;

}

footer{
    text-align: center;
    color: white;
    font-style: italic;
}
function carregar(){
    var msg = document.getElementById("msg")
    var img = document.getElementById("imagem")
    var data = new Date()
    var hora = data.getHours()
    msg.innerHtml = `Agora são ${hora} horas`
    if (hora >= 0 && hora < 12){
        img.src = 'manha.png'
        document.body.style.background = '#e2cd9f'
        
    } else if(hora >= 12 && hora <= 18 ){
        img.src = 'tarde.png'
        document.body.style.background = '#b9846f'
    } else {
        img.src = 'noite.png'
        document.body.style.background = '#515154'
    }






}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.