WEEK: 7
Active: September 28th - October 4th
Work Due: October 5th @ 11:59PM

Adding CSS to HTML

Embedded

Embedded CSS Video

The second way in which we can add CSS by using embedded styles on the page. By having embedded styles, we apply a format to only this page.

An example might look like this.

<html>
    <title>Embedded Style Example</title>
    <head>
        <style>
            span{
                background-color:red;
            }
        </style>
    </head>
    <body>
        <span>This is the first sentence.</span>
        <br />
            This is the second sentence.
        <br />
        <span>This is the third sentence</span>
    </body>
</html>

In this example, you see the first, and the third sentence has a background color of red. While the second sentence does not. The style at the top of the page within the <head> tags applies the background color to all span tags.

What are some of the positives and negatives of using embedded styles?


Previous section: