So far, you’ve got tags like <p> and <h1> making your webpage functional—but what if you want it to look good too? That’s where HTML styles come in. Before you dive into full-on CSS (that’s a whole other adventure), you can use the style attribute to add a splash of personality directly in your HTML. It’s like giving your tags a quick makeover!
The style attribute works by slipping into any opening tag, followed by some rules in the format property: value.
For example:
Load that in a browser, and the text turns blue. Easy, right? You’re telling the paragraph, “Hey, make your color blue.”
Now your heading’s purple and a little larger—perfect for grabbing attention.
The catch? You add styles one tag at a time, so it’s great for small tweaks but gets clunky for big projects. That’s when CSS takes over (we’ll get there later). For now, think of this as your playground—experiment with a paragraph or two. Maybe:
It’s a light gray box with dark green text. Mess around with colors and sizes to see what sticks.
One thing: keep it simple at first—too many styles in one tag can feel like overdecorating a room. Play a little, check it in your browser, and watch your page go from basic to bold
Sponsored Content
Enhance your HTML skills with our in-depth tutorials and interactive quizzes.
Explore HTML Quiz