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)
# Just open index.html in your browser
open index.html
# or double-click the file
./setup.sh
npm start
# Open http://localhost:8080
When you open index.html, you'll immediately see:
styles.css demonstrates element selectorsLocation: index.html - After the Pupa (Chrysalis) section (after line 32)
Success Criteria:
<h2> heading with text "Adult Butterfly"<img> tag with proper src and alt attributesContent to Use:
https://ansp.org/~/media/Images/ans/explore/online-exhibits/butterflies/lifecycle/monarch_adult.ashx?w=250&h=187&as=1&la=en&hash=5669E26C9AAFC82A841F5DFE3A5A257A1958CE55Hints:
styles.css!h2 selector will color your heading redp selector will style your paragraphimg selector will size your image to 300x200px and add rounded cornersExpected Output:
Adult Butterfly (red heading, 1.8em)
The butterfly emerges with colorful wings ready to fly... (gray text, centered)
[Butterfly image, 300x200px, rounded corners, with shadow]
Key Learning: You only need to add HTML! The CSS element selectors (img, h2, p) automatically apply to ALL elements of that type.
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.cssLayout 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