Shefarol Soluções Web

Buscador de animais - Voltar

Buscador de animais
Gato aleatório

Cão aleatório

 

Exemplo do código em JavaScript
function buscaGato() {
    fetch('https://api.thecatapi.com/v1/images/search')
    .then(res => res.json())
    .then(dados => {
        document.getElementById("imgG").src = dados[0].url;
    });
}

function buscaCao() {
    fetch('https://dog.ceo/api/breeds/image/random')
    .then(res => res.json())
    .then(dados => {
        document.getElementById("imgC").src = dados.message;
    });
}
buscaGato();
buscaCao();

 

Código em CSS
.card {
    width: 320px;
    margin: 20px auto;
    padding: 15px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    text-align: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}