flask link rel
时间: 2024-01-14 14:04:01 浏览: 123
The "link rel" attribute is used in HTML to define the relationship between the current document and the linked document. It is not specific to Flask, but it can be used in Flask templates to link to external resources such as stylesheets, scripts, images, or other web pages.
Here's an example of how to use the "link rel" attribute in a Flask template to link to a stylesheet:
```html
<!DOCTYPE html>
<html>
<head>
<title>My Flask App</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
</head>
<body>
<h1>Welcome to my Flask App</h1>
<p>This is a sample web page.</p>
</body>
</html>
```
In this example, the "link rel" attribute is used to link to a stylesheet called "style.css" located in the "static" folder of the Flask application. The "url_for" function is used to generate the URL for the static file based on the Flask application's configuration.