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.
CodePudding user response:
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">
CodePudding user response:
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>
