Python Flask Basics Templates and Static Files Static Files

William Watlington
William Watlington
3,347 Points

styles.css doesn't seem to be working?

I seem to have correctly followed the instructions in this video but can't get the colors from styles.css to work

Here's styles.css from my workspace

body {
  background: beige;
  color: mediumorchid
}

and here's layout.html

<!doctype html>
<html>
  <head>
    <title>{% block title %}Flask Basics{% endblock %}</title>
    <link rel="stylesheet" href"/static/styles.css">
  </head>
  <body>
    {% block content %}{% endblock %}
    <p>Brought to you by the fine folks at Treehouse</p>
    {% block scripts %}{% endblock %}

  </body>
</html>

1 Answer

Billy Bellchambers
Billy Bellchambers
21,689 Points

Might want to check the location of your ccs file in your <link>

Looks like you have an extra "/" at the begining of the href.

Maybe should be.

<!doctype html>
<html>
  <head>
    <title>{% block title %}Flask Basics{% endblock %}</title>
    <link rel="stylesheet" href="static/styles.css">
  </head>
  <body>
    {% block content %}{% endblock %}
    <p>Brought to you by the fine folks at Treehouse</p>
    {% block scripts %}{% endblock %}

  </body>
</html>

Hope that helps.

Happy coding

Billy Bellchambers
Billy Bellchambers
21,689 Points

just spotted as well that the "=" is missing for href ill amend that into my orginal post.

William Watlington
William Watlington
3,347 Points

Thanks! Don't know how I stared at it that long and missed that!