ljdoumas
ljdoumas

Reputation: 11

external CSS and HTML not linking

I'm just starting out with HTML and CSS and I can't figure out why my CSS won't link to my HTML template.

Index.html and style.css are in the same folder currently, and the css works fine when it's internal. Am I missing something obvious?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>

        <link rel="stylesheet" type="text/css" href="style.css">       
    </head>
    <body>
      <div class="header">
        <a href="#default" class="logo">header</a>
        <div class="header-right">
          <a class="active" href="#home">Home</a>
          <a href="#">Contact</a>
          <a href="#">About</a>
          <a href="#">test</a>
        </div>
      </div>
    
      {% block content %}{% endblock %}
      <h5>footer</h5>
    </body>
</html>

Edit: the problem seems to be some sort of compatibility issue. In safari a selected my own style sheet in preferences and it worked properly (I couldn't figure out how to do it in chrome). This doesn't seem like a permanent solution though?

Upvotes: 1

Views: 85

Answers (1)

Hardik Yewale
Hardik Yewale

Reputation: 346

you can try with putting the path of the file by using "./path" and see if it works also check whether your webserver takes your css files as text as you have given type as text/css.

Upvotes: 1

Related Questions