Skip to content

Instantly share code, notes, and snippets.

@bogoreh
Created March 11, 2021 12:10
Show Gist options
  • Select an option

  • Save bogoreh/b2dfc74938377c5f6e926fb77ceae9f2 to your computer and use it in GitHub Desktop.

Select an option

Save bogoreh/b2dfc74938377c5f6e926fb77ceae9f2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Challenge: Avatar attributes</title>
<style>
img[alt*="avatar"] {
width: 170px;
}
</style>
</head>
<body>
<h1>Which avatar is which?</h1>
<table>
<thead>
<tr>
<th>Attributes</th>
<th>Avatar</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<ul>
<li>pink</li>
<li>innocent</li>
</ul>
</td>
<td>
<img src="https://www.kasandbox.org/programming-images/avatars/marcimus.png" id="avatar-1" alt="Marcimus, A pink, innocent avatar">
</td>
</tr>
<tr>
<td>
<ul>
<li>green</li>
<li>ANGRY</li>
</ul>
</td>
<td>
<img src="https://www.kasandbox.org/programming-images/avatars/old-spice-man.png" id="avatar-2" alt="Old Spice Mann, A green, angry avatar">
</td>
</tr>
<tr>
<td>
<ul>
<li>orange</li>
<li>multi-legged</li>
</ul>
</td>
<td>
<img src="https://www.kasandbox.org/programming-images/avatars/orange-juice-squid.png" id="avatar-3" alt="Orange Juice Squid, An orange, multi-legged avatar">
</td>
</tr>
</tbody>
</table>
<script>
var avatarEls = document.getElementsByTagName("img");
for (var i = 0; i < avatarEls.length; i ++) {
avatarEls[i].height = "50";
avatarEls[i].title = avatarEls[i].alt;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment