Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Web Browser

Code Editor
A Closer Look at CSS

Link to a Stylesheet

Take a look at the web browser. Technically, this is the same site you saw in the previous exercise. It contains the exact same HTML elements and content as before. What's missing? The CSS that was used to previously style the site has been unlinked.

The HTML link element links a CSS file to an HTML file so that CSS styling can be applied. Here's an example of the link element:

<link rel="stylesheet" type="text/css" href="main.css"/>

About link:

  1. The link element uses three attributes:

    -rel: Specifies the relationship between the current file and the file being linked to: in this case, the rel attribute is "stylesheet".

    -type: Specifies the type of file linked to.

    -href: Provides the URL of the file being linked to.

  2. Like the HTML image element, link is self-closing. It does not need a closing tag.

  3. In the example above, main.css is an external style sheet. Using external stylesheets is one of the most popular ways to write CSS. Inline CSS is another method.
Report a Bug
If you see a bug or any other issue with this page, please report it here.