html的继承 extends "_base.html"
来源:互联网 发布:公司机房网络拓扑图 编辑:程序博客网 时间:2024/06/09 16:14
项目中的规范化
()_base.html
<pre-scripts>与<script>的区别:
<pre-scripts>在加载页面前加载脚本
优点:放在head中,整洁
缺点:占用时间,加载页面内容会过慢
<scripts>先加载页面内容再加载脚本
(2) index.html
继承自_base.html,作为首页
(3)其它页面
继承自index.html,导航栏及整体风格与主页保持一致,主内容区可自由编辑
()_base.html
<span style="font-size:12px;"><!DOCTYPE html><html><head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>{% block title %}{% endblock %}</title> {% block styles %}{% endblock %} {% block pre-scripts %}{% endblock %}</head><body> {% block header %}{% endblock %} {% block main %}{% endblock %} {% block footer %}{% endblock %} {% block scripts %}{% endblock %}</body></html></span>说明:整个项目中的结构框架说明,一般不作修改。
<pre-scripts>与<script>的区别:
<pre-scripts>在加载页面前加载脚本
优点:放在head中,整洁
缺点:占用时间,加载页面内容会过慢
<scripts>先加载页面内容再加载脚本
缺点:放在<body>中结构不太清晰
现在<pre-script>有一个属性,可以在加载页面内容后再加载js,只有支持html5的才支持。(2) index.html
继承自_base.html,作为首页
{% extends "_base.html" %} {% load staticfiles i18n %}{% block title %}{% trans "title" %}{% endblock %}{% block styles %} {% include "_styles.html" %} <link href="{% static 'css/app.css' %}" rel="stylesheet"> {% endblock %} {% block pre-scripts %} {% include "_pre-scripts.html" %}{% endblock %} {% block scripts %} {% include "_scripts.html" %} <script> new gnMenu( document.getElementById( 'gn-menu' ) ); </script>{% endblock %} {% block main %} <div class="container"> {% include "_nav.html" %} <header> {% block mymain %} <h1>hello,welcome</h1> {% endblock %} </header> </div>{% endblock %}
(3)其它页面
继承自index.html,导航栏及整体风格与主页保持一致,主内容区可自由编辑
0 0
- html的继承 extends "_base.html"
- dojo AMD开发之dojo/_base/html
- django的html继承
- 【java的继承extends】
- 类的继承(extends)
- 【Html】继承
- 继承extends的使用规则
- 继承(extends)
- extends 继承
- 继承(Extends)
- 继承extends
- 继承:extends
- 继承extends
- extends 继承
- HTML 模板继承
- jQuery继承的实现(extends)
- jQuery继承的实现(extends)
- java extends 继承的一些小结。
- 3115 高精度练习之减法
- stm32f207 栈溢出
- 性能测试学习
- iOS 【cartool的使用】
- iOS开发ARC内存管理技术要点
- html的继承 extends "_base.html"
- 第十五周 项目一-验证算法
- [Golang] groupcache的简单例子
- 切换手机中英文,读取assets对应的资源文件,设置到ScrollView控件中
- Notification
- Magento调试页面空白 - 解决方法
- actionbar的以下各种属性的区别.
- 第十四周项目2--二叉树排序树中查找的路径
- Nginx的负载均衡 - 保持会话 (ip_hash)