semantic-ui引入css和js(折叠菜单为例)

#index.html
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-COMPATIBLE" content="IE-edge,chrome-1" />
        <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

        <title>Semantic-UI</title>
        <link rel="stylesheet" type="text/css" href="semantic/dist/semantic.min.css"><!--引入css文件-->
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是一个简单的实现: 1. 在你的 Flask 应用中创建一个路由来展示系统通知页面,例如: ```python from flask import Flask, render_template app = Flask(__name__) @app.route('/notifications') def notifications(): notifications = [ {'title': 'New message', 'message': 'You have a new message from John.'}, {'title': 'Server maintenance', 'message': 'The server will be down for maintenance from 10 pm to 2 am.'}, {'title': 'Welcome!', 'message': 'Thank you for signing up for our service.'} ] return render_template('notifications.html', notifications=notifications) ``` 2. 在 `templates` 文件夹中创建一个名为 `notifications.html` 的模板文件,并使用 Semantic UI 样式框架来美化页面。以下是一个基本的模板示例: ```html {% extends 'base.html' %} {% block content %} <div class="ui container"> <h1 class="ui header">Notifications</h1> {% for notification in notifications %} <div class="ui segment"> <h3 class="ui header">{{ notification.title }}</h3> <p>{{ notification.message }}</p> </div> {% endfor %} </div> {% endblock %} ``` 3. 在 `base.html` 文件中定义基本的页面结构和样式,例如: ```html <!DOCTYPE html> <html> <head> <title>{% block title %}{% endblock %}</title> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='semantic.min.css') }}"> </head> <body> <div class="ui inverted vertical masthead center aligned segment"> <div class="ui container"> <div class="ui large secondary inverted menu"> <a class="active item" href="#">Home</a> <a class="item" href="#">Products</a> <a class="item" href="#">About Us</a> </div> </div> </div> {% block content %} {% endblock %} <script type="text/javascript" src="{{ url_for('static', filename='semantic.min.js') }}"></script> </body> </html> ``` 在这个模板中,我们使用 Semantic UI 的样式来创建一个响应式顶部导航栏和基本的页面结构。 4. 在 `static` 文件夹中下载并添加 Semantic UICSS 和 JavaScript 文件,例如: ``` /static /semantic.min.css /semantic.min.js ``` 5. 测试路由并查看系统通知页面。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值