0

Does anyone know, why when I try previewing my site, it doesn't show anything? Something wrong with my code?

When I check the source code, it won't tell me accurately enough what the problem is?

<head>

    <title>My Coursera Site</title>
    <link rel="stylesheet" type="text/css" href="bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script src="script.js" />

</head>

<body>

    <a href="index.html">Home</a>

    &nbsp;

    <a href="about.html">About</a>

    &nbsp;

    <a href="contact.html">Contact</a>


    <hr>

    <div class="container">

        <h1 id="title" onclick="alert('Hello');">This is a heading or title</h1>

        <div="row">

            <div class="col-md-6 thin_border">
            some content for panel 1 
            </div>

            <div class="col-md-6 thin_border">
            some content for panel 2 
            </div>

        </div>

    </div>

</body>

Sarbbottam
  • 5,410
  • 4
  • 30
  • 41
  • No way to tell from what you have here unless you have a path issue when linking the CSS – Paulie_D Feb 23 '16 at 22:34
  • Welcome to Stack Overflow. Just so you know, your question is not the kind of question that is likely to be received well on here. In particular, we need more specific information. For starters, what is the error message? It may not be accurate enough for you, but it may be completely clear to someone else. – McMath Feb 23 '16 at 22:54
  • thanks for the comment. I'll take that into account from now on. – Mikkel Worm Hansen Feb 23 '16 at 23:09

2 Answers2

1

Try to close explicitly the script tag <script src="script.js" /> Should be

<script src="script.js" ></script>

If you need more explanations you can check this question.

Community
  • 1
  • 1
IsraGab
  • 4,819
  • 3
  • 27
  • 46
  • @Mikkel Worm Hansen, since you're new here, please don't forget to mark the answer accepted which helped most in solving the problem. See also How does accepting an answer work if you don't know how to do: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)%E2%80%8C%E2%80%8B – IsraGab Feb 23 '16 at 22:41
-1

You are missing the <HTML> and the <!DOCTYPE> tags. Your code code should be like this:

<!DOCTYPE html>
<html>
    <head>
        <title>My Coursera Site</title>
        <link rel="stylesheet" type="text/css" href="bootstrap.css" />
        <link rel="stylesheet" type="text/css" href="style.css" />
        <script src="script.js" />
    </head>
    <body>
        <a href="index.html">Home</a>
        &nbsp;
        <a href="about.html">About</a>
        &nbsp;
        <a href="contact.html">Contact</a>
        <hr>
        <div class="container">
            <h1 id="title" onclick="alert('Hello');">This is a heading or title</h1>
            <div class="row">
                <div class="col-md-6 thin_border">
                some content for panel 1 
                </div>
                <div class="col-md-6 thin_border">
                some content for panel 2 
                </div>
            </div>
        </div>
    </body>
</html>

Note that you also have a wrong div tag <div="row">, which I'm assuming might be the div class property that's why I set it as class attribute on the above example. It is also recommended to add the type attribute and explicit closing tag on the JavacScript import, like this:

<script type="text/javascript" src="script.js"></script>
  • Reason why the html isn't rendering anything is not because of what you said, but because of the `` that's missing. look here: http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work – IsraGab Feb 23 '16 at 23:06
  • Thank you for the quick reply :) – Mikkel Worm Hansen Feb 23 '16 at 23:10
  • I know that. But a missing explicit closing tag is not only reason why it would affect accessibility of web content. Both tags are required and as I said at the end it's higly recommended to close the – Daniel G. Feb 23 '16 at 23:28