Django打造大型企业官网(三)
四、前端首页
4.1.导航条实现
(1)templates/new/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>知了课堂</title>
<link rel="stylesheet" href="../../dist/css/index.min.css">
<link rel="stylesheet" href="//at.alicdn.com/t/font_1239817_3xfonheuqlv.css">
</head>
<body>
<header class="header">
<div class="container"> <div class="logo-box">
<a href="/"></a>
</div> <ul class="nav">
<li class="active"><a href="/">资讯</a></li>
<li><a href="/">创业课堂</a></li>
<li><a href="/">企业服务</a></li>
<li><a href="/">搜索</a></li>
</ul> <div class="auth-box">
<i class="icon-person iconfont"></i>  
<a href="#">登录</a>
<a href="#">注册</a>
</div> </div>
</header>
</body>
</html>
阿里云图标网站:https://www.iconfont.cn/
搜索person-->>添加入库-->>添加至项目-->>编辑图标-->>放大-->>仅保存-->>查看在线链接

(2)src/css/init.scss
清除浏览器默认样式
html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,form,fieldset,legend,input,button,textarea,menu{margin:;padding:;}
header,footer,section,article,aside,nav,hgroup,address,figure,figcaption,menu,details{display:block;}
table{border-collapse:collapse;border-spacing:;}
caption,th{text-align:left;font-weight:normal;}
html,body,fieldset,img,iframe,abbr{border:;}
i,cite,em,var,address,dfn{font-style:normal;}
[hidefocus],summary{outline:;}
li{list-style:none;}
h1,h2,h3,h4,h5,h6,small{font-size:100%;}
sup,sub{font-size:83%;}
pre,code,kbd,samp{font-family:inherit;}
q:before,q:after{content:none;}
textarea{overflow:auto;resize:none;}
label,summary{cursor:default;}
a,button{cursor:pointer;}
h1,h2,h3,h4,h5,h6,em,strong,b{font-weight:bold;}
del,ins,u,s,a,a:hover{text-decoration:none;}
body,textarea,input,button,select,keygen,legend{font:12px/1.14 arial,\5b8b\4f53;color:#333;outline:;}
body{background:#fff;}
a,a:hover{color:#333;}
(3)src/css/constants.scss
放一些常量
$pageWidth: 1170px
(3)src/css/index.scss
@import "init.scss";
@import "constants.scss"; .header{
width: 100%;
height: 64px;
background: #3a3a3a;
.container{
width: $pageWidth;
height: 100%;
margin: 0 auto;
overflow: hidden; .logo-box{
width: 140px;
height: 49px;
background: url("https://www.xfz.cn/static/build/images/logo.png") no-repeat;
margin-top: 8px;
float: left; a{
display: block;
width: 100%;
height: 100%;
}
} .nav{
margin-left: 128px;
float: left; li{
float: left;
margin-right: 40px;
line-height: 64px;
height: 64px;
box-sizing: border-box;
font-size: 22px;
a{
color: #fff;
} &.active{
border-bottom: 5px solid #5c87d9;
}
}
} .auth-box{
float: right;
line-height: 64px;
height: 64px;
color: #fff; .iconfont{
color: #fff;
font-size: 20px;
} a{
color: #fff;
font-size: 22px;
}
}
}
}
导航条效果

4.2.主题盒子布局
templates/news/index.html
<div class="main">
<div class="wrapper">
<div class="news-wrapper"></div>
<div class="sidebar-wrapper"></div> </div> </div>
src/css/index.scss
.main{
width: 100%;
margin-top: 84px;
.wrapper{
width: $pageWidth;
margin: 0 auto;
background: green;
height: 1000px;
overflow: hidden;
.news-wrapper{
float: left;
width: 798px;
height: 500px;
background: yellowgreen;
}
.sidebar-wrapper{
float: right;
width: 356px;
height: 500px;
background: deeppink;
}
}
}
固定导航条
src/css/index.scss
.header{
width: 100%;
height: 64px;
background: #3a3a3a;
position: fixed;
left:;
right:;
top:;
效果

Django打造大型企业官网(三)的更多相关文章
- 超细讲解Django打造大型企业官网
本文为知了课堂黄勇老师讲的<超细讲解Django打造大型企业官网>的笔记. 第一章 Django预热 1.创建virtualenv虚拟环境 2.URL组成部分详解 3.Django介绍 4 ...
- Django打造大型企业官网
第1章 Django预热 1-为什么需要虚拟环境 2-virtualenv创建虚拟环境 3-virtualenvwrapper使用 4-URL组成部分讲解 5-课程准备工作 6-Django介绍 第2 ...
- Django打造大型企业官网(二)
三.项目环境搭建 3.1.创建项目环境和安装包 创建django项目 mkvirtualenv DjangoProject workon DjangoProject pip install -i ht ...
- Django打造大型企业官网(八)
4.16.侧边栏标题和广告位布局完成 templates/news/index.html <div class="sidebar-wrapper"> <div c ...
- Django打造大型企业官网(七)
4.13.新闻列表tab栏布局完成 templates/news/index.html <div class="list-outer-group"> <ul cl ...
- Django打造大型企业官网(六)
4.9.根据轮播图个数修改小圆点数量 src/js/index.js function Banner() { this.bannerWidth = 798; } Banner.prototype.in ...
- Django打造大型企业官网(五)
4.6.切换轮播图的箭头样式以及显示和隐藏 templates/news/index.html <span class="arrow left-arrow">‹< ...
- Django打造大型企业官网(四)
4.3.轮播图布局和样式 templates/news/index.html <div class="news-wrapper"> <div class=&quo ...
- Django打造大型企业官网(一)
一.nvm的安装 (1)下载:nvm1.16 (2)安装完成后添加环境变量 C:\Users\Administrator\AppData\Roaming\nvm (3)修改settings.txt,将 ...
随机推荐
- Winform窗体验证登陆
用户名,密码尽量不要在BLL,UIL判断,尽可能的在储存过程判断,通过返回的值不同,进行判断,这样提高安全性SQL Server储存过程代码: BEGINif(exists ( select User ...
- Java方法注释模板
普通方法 /** * ${todo} * @author: SYJP * @version 创建时间:${date} */ 覆盖方法 /** * @Title: ${enclosing_method} ...
- C# 获取U盘ID序列号及U盘信息
C# 获取U盘ID序列号及U盘信息 2011-05-20 上传大小:35KB c#VS2005U盘IDU盘信息 获取U盘ID序列号 VS2005编译通过,源码源自CSDN.已经测试好用. 可以获得 ...
- CAD参数绘制实心圆弧填充(com接口)
C#中实现代码说明: private void DrawPathToHatch1() { //把路径的开始位置移动指定的点 //参数一为点的X坐标 ,参数二为点的Y坐标,参数三为该点处开始宽度,对Po ...
- 打印出A到Z的所有字符,使用char和int转换
public class Demo14{ //A到Z的所有字符,使用char和int转换 public static void main(String[] args) { for(int i = 65 ...
- 在计算机中简单的hello程序的运行
我之前很好奇就是你所写的代码到底是如何在计算机中执行的,到底是怎样开始,从哪里开始,在哪里执行,到哪里结束,之间到底是怎么的一个过程,带着这些问题,逐渐看这方面的书籍,最近买的<深入理解计算机系 ...
- Linux 内核框架图
- 零基础入门学习Python(17)--函数:Python的乐高积木
前言 相信大家小时候都玩过神奇的乐高积木, 只要通过想象力和创造力我们可以拼凑很多神奇的东西,那么随着我们学习的深入,我们编写的Python代码也将日益增加,并且也越来越复杂, 所以呢,我们需要找寻一 ...
- db2事务日志已满解决办法
查看事务日志配置(MICRO_11为数据库名称): db2 get db cfg for MICRO_11 运行结果: 日志文件大小(4KB) (LOG ...
- Python之字符串计算(计算器)
Python之字符串计算(计算器) import re expression = '-1-2*((60+2*(-3-40.0+42425/5)*(9-2*5/3+357/553/3*99/4*2998 ...