Lists, Links & Images - Guided Notes

CSCI 4513 - Web Programming | Week 3, Class 6

Name: _________________________________ Date: _____________

📚 Today's Topics: HTML Lists (Ordered & Unordered), Links (Absolute & Relative), Images (src, alt, dimensions)

📝 HTML Lists

Two Types of Lists

1. Unordered Lists use the _________________ element

• Used when _________________ doesn't matter

• Display with _________________ points by default

2. Ordered Lists use the _________________ element

• Used when _________________ is important

• Display with _________________ by default

Both types use _________________ elements for individual list items.

List Code Structure

<!-- Unordered List --> <_____> <_____>First item</_____> <_____>Second item</_____> </_____> <!-- Ordered List --> <_____> <_____>Step 1</_____> <_____>Step 2</_____> </_____>
Practice: Create a shopping list (unordered) with 3 items:

1. _________________________________
2. _________________________________
3. _________________________________

🔗 HTML Links

The Anchor Element

Links are created using the _________________ element

The destination is specified with the _________________ attribute

<_____ _____="https://example.com"> Link text </_____>

Absolute vs Relative Links

Type Format Use Case Example
Absolute _________________ _________________ https://google.com
Relative _________________ _________________ about.html

Directory Navigation

• Current directory: _________________ (optional)

• Parent directory: _________________

• Example from subfolder: _________________/index.html

Opening Links in New Tab

Use the _________________ attribute with value _________________

⚠️ Security Alert: Always add _________________ attribute with value _________________ when opening links in new tabs!
<a href="https://example.com" _________________="_________________" _________________="_________________"> Safe external link </a>

Security Attributes Explained

noopener: _________________________________________

noreferrer: _________________________________________

🖼️ HTML Images

The Image Element

Images use the _________________ element

This is a _________________ element (no closing tag needed)

Essential Image Attributes

Attribute Purpose Required?
src _________________________________________ Yes
alt _________________________________________ Yes*
width _________________________________________ Recommended
height _________________________________________ Recommended

*Always include for accessibility!

Complete Image Code

<_____ _____="photo.jpg" _____="Description of image" _____="600" _____="400">

Why Alt Text Matters

  1. SEO: _________________________________________
  2. Accessibility: _________________________________________
  3. Fallback: _________________________________________

Image Formats

Format Best For Key Feature
JPEG/JPG _________________ Good compression
PNG _________________ Supports transparency
GIF _________________ Supports animation
SVG _________________ Scalable vector graphics
💡 Pro Tip: Keep images under _____KB for optimal performance!

🎯 Combining Concepts

Making an Image a Link

Complete the code to create a clickable logo:

<_____ _____="https://okcu.edu"> <_____ _____="okcu-logo.png" _____="Oklahoma City University" width="200" height="100"> </_____>

Navigation List with Links

Complete this navigation menu structure:

<_____> <_____><a href="index.html">Home</a></_____> <_____><a href="about.html">About</a></_____> <_____><a href="contact.html">Contact</a></_____> </_____>

✏️ Practice Problems

1. Write the HTML for an unordered list of your 3 favorite websites:





2. Create a link to Google that opens in a new tab (include security attributes):




3. Write the complete code for an image of a cat with all recommended attributes:





4. What's wrong with this code? Fix it:

<a href="https://example.com" target="_blank">Visit Example</a>

Problem: _________________________________________

Fixed code:



🔑 Key Concepts to Remember

Lists

Links

Images

📚 Homework Assignment

Task: Add a list of images that are links to your one-page website

Requirements Checklist:

Planning Your List:

Website 1: _________________________________________

Image description: _________________________________________

Website 2: _________________________________________

Image description: _________________________________________

Website 3: _________________________________________

Image description: _________________________________________

📝 Additional Notes

Use this space for any additional notes during the lecture:









⚡ Quick Reference

Common File Paths

Path Meaning
image.jpg Same folder as current file
images/photo.jpg In 'images' subfolder
../image.jpg In parent folder
../../images/pic.jpg Up two levels, then into 'images'

VS Code Shortcuts