Why does nothing appear when opening a website in a browser?

Feel me, I am very new to web programming.

here is my simple code:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link rel="stylesheet" type="text/css" href="style.css">
        <title>Carlton Banks</title>
    </head>
    <body>
        <h1>CLICK ON CARLTONS HEAD!</h1>
        <a href="http://youtu.be/zS1cLOIxsQ8" target="_blank">
            <img src="hey.jpg" alt="A picture" style="width:300px">
        </a>
    </body>
</html>

      

Here is an extremely simple css file:

body{
    h1: green
}

      

When you open the site, nothing appears in browsers, it's just this error message:

This page contains the following errors:
error on line 7 at column 10: Opening and ending tag mismatch: link line 0 and head
Below is a rendering of the page up to the first error.

      

+3


source to share


1 answer


As you are using XHTML, all tags need to be closed.

The link tag must have a slash at the end to close it:

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

      

The same for the image tag:



<img src="hey.jpg" alt="A picture" style="width:300px" />

      

CSS is wrong. I think this is what you are trying to do:

body h1 {
  color: green;
}

      

+4


source







All Articles