Introduction to Web Development
HTML & CSS Fundamentals
Lesson Objectives
Structure vs Style
Understand the difference between HTML (structure) and CSS (styling)
HTML Tags
Identify common HTML tags like <h1>, <p>, <div>, <button>
CSS Properties
Apply basic CSS properties like color, background, padding, margin
Build & Style
Create and style your first web page
What is HTML?
Hyper Text Markup Language
The Skeleton
HTML provides the structure and content of your website. It's like the bones of a building.
Common HTML Elements
<h1>...</h1>
Main Heading
<p>...</p>
Paragraph text goes here
<button>...</button>
<img src="..." />
<a href="...">...</a>
<div>...</div>
What is CSS?
Cascading Style Sheets
The Styling
CSS provides the appearance and design. It's the paint, decoration, and style of your building.
CSS Selectors
h1 { color: blue; }
Targets all <h1> elements
.button { padding: 10px; }
Targets elements with class="button"
#header { background: white; }
Targets element with id="header"
The CSS Box Model
Every HTML element is a rectangular box
margin: 20px; border: 5px solid; padding: 15px;
Box Model: Interactive Demo
Working with Colors
Named Colors
color: red;
140+ predefined color names
Hexadecimal
color: #576A8F;
6-digit color codes
RGB
color: rgb(87, 106, 143);
Red, Green, Blue values
RGBA
color: rgba(255, 116, 68, 0.7);
RGB with transparency
CSS Typography
font-family: serif;
The quick brown fox
font-family: sans-serif;
The quick brown fox
font-family: monospace;
The quick brown fox
font-size: 24px;
Size
font-weight: bold;
Weight
text-align: center;
text-decoration: underline;
Decoration
CSS Display Property
display: block;
Takes full width, stacks vertically
display: inline-block;
Side by side, respects width/height
display: flex;
Flexible, powerful layout control
Flexbox Layout
CSS Positioning
static
Default position, normal document flow
relative
Positioned relative to normal position
absolute
Positioned relative to parent
fixed
Fixed to viewport, doesn't scroll
Hover Effects & Transitions
Try hovering over these elements!
Scale
transform: scale(1.1);
Rotate
transform: rotate(5deg);
Color Change
background: gradient;
Shadow
box-shadow: large;
transition: all 0.3s ease;
CSS Pseudo-classes
:hover
button:hover { background: blue; }
:active
button:active { transform: scale(0.95); }
:focus
input:focus { border-color: orange; }
:first-child
- First item (styled)
- Second item
- Third item
li:first-child { color: orange; }
Responsive Design
Media Queries
@media (max-width: 768px) {
.container {
flex-direction: column;
}
}
Adjust styles based on screen size
CSS Quick Reference
Text
colorfont-sizefont-weighttext-alignline-height
Box Model
marginpaddingborderwidthheight
Background
background-colorbackground-imagebackground-sizebackground-position
Layout
displaypositionflex-directionjustify-contentalign-items
Practice Time!
Let's create your first header
Your Task:
1. Open your text editor (Notepad, VS Code, etc.)
2. Create a file named mypage.html
3. Copy this starter code:
Challenge:
<p> paragraph with a fun fact about yourself
Quick Quiz!
Test your knowledge
What does HTML stand for?
Thank You!
Questions?