Alguien me la pidió y la traigo, sigan las instrucciones al pie de la letra.
Lee atentamente.
Es un gadget.
- Copia y pega este código y ponlo en tu escritorio.
- Ahora cambia el texto en negritas o donde dice XXXXXX y pon tu código de color. (esta por el inicio), para los detalles cambien los 6 YYYYYY. (Las Y son lo negro)
- Copia y pega el código nuevamente y pégalo en el apartado de diseño como un gadget.
Pokedex.
Código Java:
<style>
/* Ancho fijado a 240px para que encaje sobrado en tu columna de 300px */
.pokedex-retro-box {
background: #XXXXXX;
border: 6px solid #fff;
padding: 6px;
width: 240px;
box-sizing: border-box;
margin: 5px auto;
text-align: center;
font-family: Arial, sans-serif;
color: #fff;
box-shadow: 4px 4px 0px #YYYYYY;
}
.poke-display {
background-image: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRMGxUQun5qyYt-i1aRK_r-eezX-gEEEOmH49Wbs0sf&s=10');
background-size: cover;
border: 4px solid #YYYYYY;
margin-bottom: 8px;
display: flex;
align-items: center;
justify-content: center;
image-rendering: pixelated;
min-height: 150px;
}
/* Imagen ajustada para que no sobresalga en 240px */
.poke-display img {
width: 140px;
image-rendering: pixelated;
}
.poke-controls { margin-bottom: 8px; display: flex; justify-content: center; gap: 4px; }
.poke-btn {
padding: 5px 8px;
cursor: pointer;
border: 2px solid #YYYYYY;
background: #ddd;
font-family: Arial, sans-serif;
font-weight: bold;
color: #YYYYYY;
font-size: 10px;
}
.poke-btn:hover { background: #ffcc00; }
.poke-info {
text-align: left;
background: #YYYYYY;
padding: 6px;
font-size: 11px;
border: 2px solid #YYYYYY;
font-family: Arial, sans-serif;
}
.poke-desc {
margin-top: 6px;
color: #aaa;
font-size: 10px;
line-height: 1.2;
font-family: Arial, sans-serif;
}
</style>
<div class="pokedex-retro-box" id="pokedex-app">
<div class="poke-display"><img id="pokeImg" src="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/1.png" alt="Pokemon" /></div>
<div class="poke-controls">
<button class="poke-btn" onclick="cambiarPokemon(-1)">◀ ANT</button>
<button class="poke-btn" onclick="cambiarPokemon(1)">SIG ▶</button>
</div>
<div class="poke-info">
<div><strong>N°:</strong> <span id="pokeId">1</span></div>
<div><strong>NOM:</strong> <span id="pokeName">BULBASAUR</span></div>
<div><strong>TIPO:</strong> <span id="pokeType">GRASS, POISON</span></div>
<div class="poke-desc" id="pokeDesc">Cargando...</div>
</div>
</div>
<script>
window.currentPokeId = 1;
async function cambiarPokemon(dir) {
window.currentPokeId += dir;
if (window.currentPokeId < 1) window.currentPokeId = 1;
try {
const res = await fetch(`https://pokeapi.co/api/v2/pokemon/${window.currentPokeId}`);
const data = await res.json();
const resSpec = await fetch(data.species.url);
const dataSpec = await resSpec.json();
const flavorText = dataSpec.flavor_text_entries.find(e => e.language.name === 'es');
document.getElementById('pokeImg').src = data.sprites.front_default;
document.getElementById('pokeId').innerText = data.id;
document.getElementById('pokeName').innerText = data.name.toUpperCase();
document.getElementById('pokeType').innerText = data.types.map(t => t.type.name.toUpperCase()).join(', ');
document.getElementById('pokeDesc').innerText = flavorText ? flavorText.flavor_text : "Sin descripción.";
} catch (e) { console.error("Error al cargar:", e); }
}
</script>

Super cool! amé la estética de tu blog 💚
ResponderBorrarSuper graciassss y por cierto eres el primer comentario
Borrar