1

Inside the project folder, I have created both the html and CSS file under 'venv' library root folder. html file name - index.html CSS file name - styles.css

code that I used to link CSS: <link rel="stylesheet" href="styles.css" type="text/css">

This does not seem to work. Need help.

1

2 Answers 2

1

CSS is not available in PyCharm Community but it will work perfectly in the Professional edition. Also, if you face a problem with the static file use href="{% static "static/d.css"%}" and change the setting.py You can see how to add it. I run the code below in PyCharm 2021.3.1 (Professional edition).

body {
  background-color: lightblue;
}

h1 {
  color: navy;
  margin-left: 20px;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <link rel="stylesheet" href="d.css" type="text/css" />
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the quick response. I switched to atom ide for now because I am a beginner and I do not have the fundamentals in place but your response might help me later
0

I am not sure but check it. you can add the folder what the css file is found. like this: <link rel="stylesheet" href="../root/styles.css" type="text/css">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.