By the end of this lesson, you will:
Make sure you have:
:information_source: Info What is CSS? CSS (Cascading Style Sheet) is like the paintbrush for your website! While HTML creates the structure (like walls and doors of a house), CSS adds the colors, sizes, and decorations (like paint, wallpaper, and furniture).
In EduBlocks, CSS blocks help you:
CSS transforms plain web pages into beautiful, colorful websites. Here's what CSS does:
:bulb: Tip: Building Blocks to Real Code In EduBlocks, when you use style blocks, you're actually creating CSS code! Each color block or style block gets converted into real CSS that browsers understand.
See the amazing difference CSS makes:
Without CSS | With CSS |
---|---|
Your website looks like a plain text document - boring and hard to read! | Your website becomes colorful, organized, and fun to explore! |
![]() |
![]() |
note Visual Difference Notice how the website with CSS has:
In EduBlocks, you can add CSS styles in three different ways:
Apply styles to just one element at a time
Apply styles to your whole webpage
Apply styles to multiple webpages (We'll learn this in a future course!)
:bulb: Tip: What We'll Learn Today In this lesson, we'll focus on:
- Inline CSS - Quick styling for individual elements
- Internal CSS - Organizing styles for your whole page
:information_source: Info What is Inline CSS? Inline CSS lets you add styles directly to one HTML element. It's like painting one specific thing in your picture!
In EduBlocks, you use the style attribute block to add colors, sizes, and other styles to individual elements.
When you want to style just one element, attach a style block directly to it:
Want to add more than one style? Use this special block:
Here's an example using inline CSS in EduBlocks:
Code |
---|
![]() |
Output |
![]() |
note Block to Code Connection When you connect style blocks in EduBlocks, it creates code like this:
<h1 style="color: blue;">My Title</h1>
The blocks make it visual and easy!
:information_source: Info What is Internal CSS? Internal CSS lets you create a style sheet for your entire webpage. It's like having a color palette that you can use for everything on your page!
In EduBlocks, you put style blocks in the head section to style multiple elements at once.
Internal CSS uses a special structure in your HTML:
:bulb: Tip: Where Does It Go? Internal CSS always goes in the
<head>
section of your HTML, inside a<style>
tag. Think of it as the instruction manual at the beginning of your webpage!
Here's how internal CSS looks in EduBlocks:
Code |
---|
![]() |
Output |
![]() |
note Block to Code Connection Your style blocks in the head section create code like this:
<style>
h1 { color: red; }
p { color: blue; }
</style>
EduBlocks makes it visual and fun!
Having trouble with your CSS? Check these common issues:
Styles not showing?
<head>
sectionColors look wrong?
Nothing happens when you add styles?
You've learned how to make your websites beautiful with CSS! Here's what you discovered:
Try these fun challenges:
:bulb: Tip: Next Steps In the next lesson, you'll learn about specific CSS properties to make your websites even more amazing! Keep practicing with different colors and styles.