弄一个静态oppo官网页面
一个静态的oppo官网页面制作过程
先看效果图
完整项目下载
一、项目准备
素材下载
新建一个项目文件夹命名为项目名
目录如下
reset.css
/* 因为不是全部标签都有默认内外边距,做项目的时候清除默认边距可以选
中对应标签去清除,代码执行效率就更高 */
h1,
h2,
h3,
h4,
h5,
h6,
body,
p,
dl,
dt,
dd,
ul,
li,
ol {
padding: 0;
margin: 0;
}
li {
list-style: none;
}
body {
font: 14px "微软雅黑";
color: #999;
}
a {
text-decoration: none;
color: #999;
}
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!-- 引入重置样式 -->
<link rel="stylesheet" href="css/reset.css">
<!-- 引入自定义样式 -->
<link rel="stylesheet" href="css/style.css">
</head>
<body>
</body>
</html>
二、过程编写
从上到下的顺序编写
1、版心和顶通盒子
结构分析:
先把整体网页的版心给确定下来,再把最上层的盒子大小确定
style.css
/* 版心 */
.w {
width: 1180px;
margin: 0 auto;
}
.topBar {
height: 37px;
background: #2b2b2b;
border-top: 3px solid green;
}
.barIn{
height: 37px;
background-color: pink;
}
index.html
<div class="topBar">
<div class="barIn w"></div>
</div>
效果图
2、顶通栏
参考图:
分析: 最左边的小图标可以用a 数字用p
右边就是ul>li li中包含a。都加上右边框
右边的内容宽度不一样 可以设置内边距让盒子的宽度由内容撑开
index.html
<!-- 顶通栏的左边 -->
<div class="barL">
<a href="#">
<img src="images/icons/weibo_01.png" alt="">
</a>
<a href="#">
<img src="images/icons/tencent_02.png" alt="">
</a>
<p>4001-666-888</p>
</div>
<!-- 顶通栏的右边 -->
<ul class="barR">
<li><a href="#">注册</a></li>
<li><a href="#">积分兑换</a></li>
<li><a href="#">帮助中心</a></li>
<li><a href="#">登录</a></li>
<li><a href="#" class="gwc">购物车</a></li>
</ul>
style.css
.barL{
float: left;
}
.barL a,p,li{
float: left;
}
/*
设置顶通栏左边图片的位置
*/
.barL :nth-child(1){
margin:2px 15px 0 0;
}
.barL :nth-child(2){
margin:4px 15px 0 0;
}
/*
设置顶通栏右边的导航栏
*/
.barR{
float:right;
}
.barR li{
float: left;
}
.barR a{
padding: 0 15px;
border-right: 1px solid #999999;
/* background-color: black; */
}
/* 设置购物车图标
background:颜色 url 禁止平铺 坐标x 坐标Y
*/
.barR .gwc{
background: url("../images/icons/cart_02.png") no-repeat 15px center;
padding-left: 43px;
}
结果展示:
效果图
3、头部
logo部分:h1 a 文字 背景图(参考各大网站的logo设置 方便SEO((Search Engine Optimization))优化)
index.html
<!-- 头部 -->
<div class="header w">
<!-- 左边的logo -->
<h1 class="logo">
<a href="index.html">
oppo官网
</a>
</h1>
<!-- 右边的导航 -->
<ul class="nav">
<li class="cur"><a href="#">首页</a></li>
<li><a href="#">手机配件</a></li>
<li><a href="#">服务</a></li>
<li><a href="#">专卖店</a></li>
<li><a href="#">应用商店</a></li>
<li><a href="#">ColorOS</a></li>
<li><a href="#">社区</a></li>
</ul>
</div>
style.css
/*在上面的顶通栏添加个超出隐藏*/
.topBar {
height: 37px;
background: #2b2b2b;
border-top: 3px solid green;
/* 添加个超出隐藏 */
overflow: hidden;
}
/**
* 头部
*/
.header{
height: 87px;
}
.logo{
width: 160px;
height: 30px;
float: left;
}
/* a指定宽高不会生效 所以要变成块 */
.logo a{
display: block;
width: 160px;
height: 30px;
background: url("../images/logo.png")no-repeat;
/* test-indent 文字缩进 往左超出范围就隐藏了,往右不行*/
text-indent: -9999px;
margin-top: 28px;
}
.nav{
height: 87px;
float: right;
line-height: 87px;
}
.nav li{
float: left;
font-size: 18px;
font-weight: bold;
margin: 0 18px;
}
.nav a{
color: #2b2b2b;
}
.cur a{
color: #00935f;
}
结果展示
代码:
效果图
4、banner
暂时先用一张图代替轮播图 后面有空再补充
index.html
<!-- banner -->
<div class="banner">
<a href="#"></a>
</div>
style.css
/**
* banner
*/
.banner{
height: 621px;
}
.banner a{
display: block;
height: 621px;
background: url("../images/banner.jpg") no-repeat center top;
}
结果展示:
代码图
展示图
5、内容_明星机型
5.1、明星机型标题区域
目标效果
index.html
<!-- 内容区域 -->
<!-- 明星机型 -->
<div class="star">
<div class="starIn w">
<!-- 标题盒子 -->
<div class="star_title">
<!-- 线 -->
<div class="line"></div>
<h3>OPPO <strong>STAR</strong> 明星机型</h3>
<div class="line"></div>
<p> COLLECTION <a href="">全部手机</a></p>
</div>
</div>
</div>
style.css
/**
* 内容区域
*/
/* 明星机型 */
.star {
height: 846px;
background-color: #f2f2f2;
}
.starIn {
height: 846px;
}
.star_title {
padding-top: 47px;
text-align: center;
}
.star_title .line {
width: 92px;
height: 1px;
background-color: #dadada;
margin: 0 auto;
transition: 0.5s;
}
.star_title h3 {
height: 48px;
line-height: 48px;
font-size: 28px;
font-weight: 400;
color: #2b2b2b;
}
.star_title p{
height: 62px;
line-height: 62px;
}
.star_title p a{
color: #00935f;
}
/* 鼠标移动线变长的动画 */
.star_title:hover .line{
width: 150px;
}
结果展示:
代码
效果图
5.2、手机结构
分析如下
调整间距小技巧
参考淘宝网页的技巧
版心width只有1180
如果设置手机li的 宽
width 280px
margin-right 20px
那么就会滑下去一个
这时候可设置.model的width为1200 这样无论多少条数据也不会滑下去 调整方便
index.html
<!-- 手机 -->
<ul class="mobile">
<li>
<a href="#">
<img src="./images/mobile01.jpg" alt="">
<h4>OPPO Find7</h4>
<p class="store">4G全年旗舰</p>
<p class="buy">
¥ 3498 立即购买
<span>></span>
</p>
</a>
</li>
</ul>
<ul class="mobile">
<li>
<a href="#">
<img src="./images/mobile02.jpg" alt="">
<h4>OPPO Find7</h4>
<p class="store">4G全年旗舰</p>
<p class="buy">
¥ 3498 立即购买
<span>></span>
</p>
</a>
</li>
</ul>
<ul class="mobile">
<li>
<a href="#">
<img src="./images/mobile03.jpg" alt="">
<h4>OPPO Find7</h4>
<p class="store">4G全年旗舰</p>
<p class="buy">
¥ 3498 立即购买
<span>></span>
</p>
</a>
</li>
</ul>
<ul class="mobile">
<li>
<a href="#">
<img src="./images/mobile04.jpg" alt="">
<h4>OPPO Find7</h4>
<p class="store">4G全年旗舰</p>
<p class="buy">
¥ 3498 立即购买
<span>></span>
</p>
</a>
</li>
</ul>
</div>
</div>
style.css
/* 手机部分 */
.mobile li{
text-align: center;
float: left;
width: 280px;
height: 570px;
border-bottom: 5px solid #dfdfdf;
margin-right: 20px;
}
.mobile h4{
color: #2b2b2b;
height: 60px;
line-height: 60px;
}
.mobile .store{
height: 30px;
line-height: 30px;
}
.mobile .buy{
height: 20px;
line-height: 20px;
color: #00935f;
}
.mobile span{
width: 18px;
height: 18px;
background-color: #00935f;
color: white;
border-radius: 50%;
/* 如果是block会换行 */
display: inline-block;
text-align: center;
line-height: 18px;
/* 黑体的>比较方正 */
font-family: "黑体";
}
/* 调整列表的间距 */
.mobile{
width: 1200px;
}
结果展示:
代码
效果图
6、内容_配件区域
index.html
<!-- machine 配件区域开始 -->
<div class="machine">
<div class="w">
<div class="machine-top">
<div class="conmon-title">
<div class="line"></div>
<div class="title">
OPPO <span>ACCESSORY</span> 精选配件
</div>
<div class="line"></div>
</div>
</div>
<div class="machine-b">
<div class="mac-b-l">
<ul>
<li class="mr"><a href="#"><img src="./images/list01.png" alt=""></a></li>
<li><a href="#"><img src="./images/list02.png" alt=""></a></li>
<li><a href="#"><img src="./images/list06.png" alt=""></a></li>
<li><a href="#"><img src="./images/list03.png" alt=""></a></li>
</ul>
</div>
<div class="mac-b-r">
<ul>
<li><a href="#"><img src="./images/list08.png" alt=""></a></li>
<li class="mr"><a href="#"><img src="./images/list04.png" alt=""></a></li>
<li><a href="#"><img src="./images/list05.png" alt=""></a></li>
<li><a href="#"><img src="./images/list07.png" alt=""></a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- machine 配件区域结束 -->
style.css
/* machine 配件区域开始 */
.machine {
background-color: #f6f6f6;
}
.machine .machine-top {
padding-top: 28px;
padding-bottom: 61px;
}
.machine .machine-b {
height: 929px;
}
.machine .machine-b .mac-b-l {
width: 584px;
float: left;
}
.machine .machine-b .mac-b-r {
width: 584px;
float: right;
}
.machine .machine-b li {
float: left;
margin-bottom: 20px;
overflow: hidden;
}
.machine .machine-b li img {
display: block;
transition: transform 1s;
}
.machine .machine-b li:hover img {
transform: scale(1.1);
}
.machine .machine-b li.mr {
margin-right: 20px;
}
/* machine 配件区域结束 */
结果展示:
代码
效果图
7、内容_探索区域
index.html
<!-- 探索区域开始 -->
<div class="tansuo">
<div class="w">
<div class="tansuo-top">
<div class="conmon-title">
<div class="line"></div>
<div class="title">
<span>WORLD</span> OF OPPO 探索欧珀
</div>
<div class="line"></div>
</div>
</div>
<div class="tansuo-bottom">
<div class="left">
<ul>
<li><img src="./images/con_left01.jpg" alt=""></li>
<li><img src="./images/con_left02.jpg" alt=""></li>
<li><img src="./images/con_left03.jpg" alt=""></li>
<li><img src="./images/con_left04.jpg" alt=""></li>
</ul>
</div>
<div class="right"><img src="./images/tab.jpg" alt=""></div>
</div>
</div>
</div>
<!-- 探索区域结束-->
<!-- 内容区域结束 -->
style.css
/* 探索区域开始 */
.tansuo {
background-color: #eaeaea;
}
.tansuo-top {
padding-top: 44px;
padding-bottom: 41px;
}
.tansuo-bottom {
height: 575px;
}
.tansuo-bottom .left {
width: 800px;
float: left;
}
.tansuo-bottom .left li {
float: left;
margin-right: 20px;
margin-bottom: 20px;
}
.tansuo-bottom .right {
float: right;
width: 380px;
}
/* 探索区域结束 */
/*内容区域结束 */
结果展示:
代码
效果图
8、底部_保障区域
index.html
<!-- 底部区域开始 -->
<!-- 保障区域开始-->
<div class="baozhang w">
<ul>
<li>
<p>正品保障</p>
<p>保障所有产品都是原装正品</p>
</li>
<li>
<p>正品保障</p>
<p>保障所有产品都是原装正品</p>
</li>
<li>
<p>正品保障</p>
<p>保障所有产品都是原装正品</p>
</li>
<li>
<p>正品保障</p>
<p>保障所有产品都是原装正品</p>
</li>
<li>
<p>正品保障</p>
<p>保障所有产品都是原装正品</p>
</li>
</ul>
</div>
<!-- 保障区域结束-->
style.css
/* 保障区域开始 */
.baozhang {
padding: 43px 0 36px 0;
height: 45px;
}
.baozhang li {
float: left;
height: 45px;
padding-left: 55px;
/* width: 236px; */
width: 181px;
background: url(../images/icons/list01_02.png) no-repeat left center;
/* background-color: pink; */
font-size: 14px;
}
.baozhang li p {
height: 21px;
line-height: 21px;
}
.baozhang li p:nth-child(2) {
color: #999999;
}
/* 保障区域结束 */
结果展示:
代码
效果图
9、底部_list 链接区域
index.html
<!-- list 链接区域开始 -->
<div class="list">
<div class="w">
<dl>
<dt>关于我们</dt>
<dd><a href="#">关于我们</a></dd>
<dd><a href="#">新闻中心</a></dd>
<dd><a href="#">人才招聘</a></dd>
</dl>
<dl>
<dt>关于我们</dt>
<dd><a href="#">关于我们</a></dd>
<dd><a href="#">新闻中心</a></dd>
<dd><a href="#">人才招聘</a></dd>
</dl>
<dl>
<dt>关于我们</dt>
<dd><a href="#">关于我们</a></dd>
<dd><a href="#">新闻中心</a></dd>
<dd><a href="#">人才招聘</a></dd>
</dl>
<dl>
<dt>关于我们</dt>
<dd><a href="#">关于我们</a></dd>
<dd><a href="#">新闻中心</a></dd>
<dd><a href="#">人才招聘</a></dd>
</dl>
<dl>
<dt>关于我们</dt>
<dd><a href="#">关于我们</a></dd>
<dd><a href="#">新闻中心</a></dd>
<dd><a href="#">人才招聘</a></dd>
</dl>
<dl class="last">
<dt>关于我们</dt>
<dd>
<p class="contact">4001-666-888</p>
<p>7*24小时客服电话</p>
</dd>
<dd class="qq">
<p class="contact">在线QQ客服</p>
<p>服务时间段8:30-22:00</p>
</dd>
</dl>
</div>
</div>
<!-- list 链接区域结束 -->
<!-- 底部区域结束 -->
style.css
/* list 链接区域开始 */
.list {
border-top: 1px solid #ccc;
padding-top: 34px;
height: 175px;
}
.list dl {
float: left;
width: 196px;
font-size: 14px;
}
.list dl dt,
.list dl dd {
height: 30px;
line-height: 30px;
}
.list dl dt {
font-weight: 700;
}
.list dl dd a {
color: #999999;
}
.list dl.last dd {
margin-top: 7px;
height: 50px;
padding-left: 50px;
background: url(../images/icons/phone_02.png) no-repeat;
}
.list dl.last dd.qq {
background: url(../images/icons/qq_02.png) no-repeat;
}
.list dl.last dd p {
font-size: 12px;
line-height: 17px;
color: #999;
}
.list dl.last dd p.contact {
color: #00925f;
}
/* list 链接区域结束 */
结果展示:
代码
效果图
10、footer区域
index.html
<!-- footer区域 -->
<div class="footer"> -->
<div class="w">
<div class="left">
©2014东莞市永盛通信科技有限公司 粤ICP 备08130115号
</div>
<ul class="right">
<li><a href="#">版权说明</a></li>
<li><a href="#">使用协议</a></li>
<li><a href="#">网站地图</a></li>
<li><a href="#">友情链接</a></li>
<li><a href="#">联系我们</a></li>
</ul>
</div>
</div>
<!-- footer区域结束 -->
style.css
/* footer区域 */
.footer {
height: 72px;
line-height: 72px;
background-color: #2b2b2b;
font-size: 12px;
}
.footer .left {
float: left;
padding-left: 130px;
background: url(../images/logo2.jpg) no-repeat left center;
color: #929292;
}
.footer .right {
float: right;
}
.footer .right li {
float: left;
margin-left: 42px;
}
.footer .right li a {
color: #929292;
}
结果展示:
代码
效果图
总结
暂时先这样了有的效果暂时还是图片 以后有空会进行更改的
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhgeifag
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel下划线不显示怎么办
PHP中文网 06-23 -
excel打印预览压线压字怎么办
PHP中文网 06-22 -
怎样阻止微信小程序自动打开
PHP中文网 06-13 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01