Adding some style


Let's get back to the lesson “HTML document” and see how our last example look in a web browser:


As you can see, it looks absolutely boring. Like if we've got back to 1990s. To make it look better we need to customize it. Customize everything: the font family, its weight and style, a text and background colors, margins, sizes, etc.

Previously you have learned HTML attributes, like href of a element or src of img. There are a lot of other attributes which allow you to customize HTML elements appearance. However you should consider them as a legacy. This is an old-fashion way of styling. We won't use HTML attributes to do styling, we will use CSS instead.

There are two ways of adding CSS styles into your web page: inline and external. We'll start with inline.

<!DOCTYPE html>
        <!-- Here goes the stylesheet -->
        <style type="text/css">
                background-color: #00203fff;
                color: #adefd1ff;
                font-family: "Ubuntu";
                font-size: 20px;
                margin: 1em;

                font-weight: normal;

                color: #ffffff;

                border-radius: 1em;

        <title>My First Web Page</title>
        <h1>My first big web page</h1>
            Hello there. My name is Sam and I'm a junior web developer
            One day I will get rich and buy
            <a href="">this</a> car:
            <img src="" />


Ah, much cooler! I believe that you've already understood how style properties are configured there just by looking at their names and values. CSS itself is very easy, you can learn all of the properties and their possible values very quickly. However you need a deeper understanding of HTML layouting principles to learn how to apply CSS styles to get a desireable result. We will start digging into that direction in the next lesson.

Rate this post:
Share this page:

Learning plan

What you're going to deal with
HTML elements and the basic document structure
There are a couple of SEO tips you should learn about right away
4. Adding some style
Pure HTML is boring, so let's add some styles

Cross related lessons

Embedding PHP script into HTML — Lesson 2