Michael Krapf
Michael Krapf

Reputation: 75

External CSS dosent wokr on body (closed)

Hello Guys
I have this Code on my website and i want to make the html and body tag 100% height but I am not sure why it dosent get the code from the style.css. Could anybody tell me my error?

<style>
html, body {
  display: block;
  height: 100%;
  width: 100%;
  margin: 0;
}
</style>
<html>
  <head>
    <meta charset="utf-8">
    <title>Startseite</title>
    <link rel="stylesheet" href="CSS/style.css">
    <link rel="stylesheet" href="CSS/main-nav.css">
  </head>
  <body>
    <div class="test">
      <div class="topnav">
        <a href="">Startseite</a>
        <a href="">Sonstiges</a>
        <a href="">Sonstiges</a>
        <a  href="regestrierung.html">Regestrieren</a>
      </div>
    </div>
  </body>
</html>

Upvotes: 0

Views: 55

Answers (3)

Shahzad Ali
Shahzad Ali

Reputation: 41

Remove style tag because we only add style tag when we are adding css in html file,but in external file we don't add style tag

Upvotes: 0

ArturHarutyunyan
ArturHarutyunyan

Reputation: 113

Your code works, body getting 100% width and height, set body background color to see changes

Upvotes: 0

Sebak Thapa
Sebak Thapa

Reputation: 321

When you got external CSS (separate file for CSS) you don't have to enclose your stylings in <style> tag.

Simply the style.css file should look like this:

html, body {
  display: block;
  height: 100%;
  width: 100%;
  margin: 0;
}

Upvotes: 2

Related Questions