Student starter code (30% baseline)
index.html
- Main HTML pagescript.js
- JavaScript logicstyles.css
- Styling and layoutpackage.json
- Dependenciessetup.sh
- Setup scriptREADME.md
- Instructions (below)💡 Download the ZIP, extract it, and follow the instructions below to get started!
Create a Butterfly Life Cycle webpage using CSS element selectors to style multiple elements at once.
Time: 20 minutes (15 min coding + 5 min testing)
Build a butterfly life cycle webpage with 4 stages (Egg, Larva, Pupa, Adult), each with heading, description, and image. Style all images and center content using CSS selectors.
./setup.sh
npm start
# Open http://localhost:8080
<img>
tag under each descriptionalt
textProvided Image URLs:
https://i.pinimg.com/originals/92/0b/70/920b7009540e1cc306911d60e846441a.jpg
https://ansp.org/.../monarch_caterpillar.ashx?w=180...
https://ansp.org/.../monarch_chrysalis.ashx?w=182...
https://ansp.org/.../monarch_adult.ashx?w=250...
styles.css
file<head>
img { width: 300px; height: 200px; }
body { text-align: center; }
Element Selector - Targets ALL elements of a type:
img {
width: 300px; /* Applies to ALL images */
height: 200px;
}
body {
text-align: center; /* Centers all content */
}
Key Concept: One CSS rule styles multiple elements!
The Butterfly Life Cycle
Egg
The butterfly starts as a tiny egg...
[Butterfly egg image]
Larva (Caterpillar)
The caterpillar hatches and eats...
[Caterpillar image]
Pupa (Chrysalis)
The caterpillar forms a chrysalis...
[Chrysalis image]
Adult Butterfly
The butterfly emerges with wings...
[Butterfly image]
[All centered, images 300x200px]
Images not loading?
src
attribute has full URLCSS not applying?
<link>
tag in <head>
styles.css
Layout wrong?
img:hover { transform: scale(1.1); }
img { border: 2px solid black; }
Activity 04 - CSS Selectors W1: Front-end Design & User Experience Telebort Engineering | 20 minutes