linking custom CSS in flask
Create a "static" folder in your Flask project directory.
Inside the "static" folder, create a "css" subfolder.
Place your custom CSS file (e.g., "style.css") inside the "css" subfolder.
In your Flask template (HTML file), use the
url_for
function to generate the correct URL for the static file. Import theurl_for
function at the top of your HTML file if not already imported.
```html
```
Ensure that the url_for
argument corresponds to the structure of your "static" folder.
- Run your Flask application, and the custom CSS file should be linked and applied to the HTML templates.
Note: Make sure that the Flask app is structured appropriately, with the "static" folder at the top level, and the CSS file within the "css" subfolder. The url_for
function is used to generate the correct URL for static files, ensuring that they are served correctly when the application is run.