学习HTML5+CSS3 (8.7)将图片转成HTML

目标图片:


目标



切图1


切图2


切图05


切图06


切图07

html:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<link rel="stylesheet" href="css/parter7.css" />

<title></title>

</head>

<body>

<div class="demo">

<div class="top">

<img src="img/parter7-01.png" />

<p class="p1">太平洋网络推荐</p>

<div class="xiaogezi">

<p>居家网</p>

<div class="lvse3px"></div>

</div>

<div class="xiaogezi">

<p>亲子网</p>

<div class="huangse3px"></div>

</div>

<div class="xiaogezi">

<p>时尚网</p>

<div class="fense3px"></div>

</div>

<div class="xiaogezi">

<p>汽车网</p>

<div class="juse3px"></div>

</div>

<div class="xiaogezi">

<p>电脑网</p>

<div class="lanse3px"></div>

</div>

</div>

<div class="bottom">

<div class="left">

<img src="img/parter7-02.png" />

<ul class="xulleft">

<li></li>

<li></li>

<li></li>

<li></li>

<li></li>

</ul>

</div>

<div class="md">

<p class="bottomP1">汽车资讯</p>

<p class="bottomP2">汽车商城</p>

<div class="md_left">

<div class="wunai">

<img src="img/parter7-05.png" />

<p>广汽菲克Jeep</p>

</div>

<ul class="md_ul">

<li>

<div class="hui3px"></div>轩逸最高优惠3.1万</li>

<li>

<div class="hui3px"></div>大众Polo最高优惠0.8万</li>

</ul>

</div>

<div class="md_right">

<p class="md_right_p1">Jeep75周年庆 0元开走Jeep</p>

<p class="md_right_p2">活动时间4月30日</p>

<p class="md_right_p3">共有<span>300</span>人报名</p>

<input type="submit" class="submit" value="我要参加" />

<ul class="md_ul">

<li>

<div class="hui3px"></div>帕萨特最高优惠2.5万</li>

<li>

<div class="hui3px"></div>宝来最高优惠1.15万</li>

</ul>

</div>

</div>

<div class="right">

<p class="right_P">新车推荐</p>

<div class="tupian">

<img src="img/parter7-06.png">

<p>上汽通用雪佛兰探界者</p>

</div>

<ul class="right_ul">

<li>

<div class="hui3px"></div>帕萨特最高优惠2.5万</li>

<li>

<div class="hui3px"></div>宝来最高优惠1.15万</li>

</ul>

<div class="tupian1">

<img src="img/parter7-07.png">

<p>东风日产新款奇骏</p>

</div>

<ul class="lastul">

<li>

<div class="hui3px"></div>英菲尼迪新款Q60上市</li>

<li>

<div class="hui3px"></div>2017款东南V5菱致上市</li>

</ul>

</div>

</div>

</div>

</body>

</html>


CSS:

* {

padding: 0;

margin: 0;

}

.demo {

margin: 200px auto;

width: 1120px;

height: 313px;

/*background: salmon;*/

}

.top {

width: 1110px;

height: 52px;

background: white;

margin: 0 auto;

border-bottom: 3px solid #e5e5e5;

z-index: 1;

}

.top>img {

margin: 14px 0 0 10px;

float: left;

}

.p1 {

font-family: "微软雅黑";

font-size: 27px;

line-height: 27px;

height: 27px;

color: #0077dd;

float: left;

margin: 14px 0 0 5px;

}

.xiaogezi {

width: 54px;

height: 24px;

/*background: skyblue;*/

float: right;

margin-top: 28px;

margin-left: 2px;

z-index: 2;

position: relative;

}

.xiaogezi>p {

font-family: "微软雅黑";

font-size: 12px;

height: 12px;

line-height: 12px;

text-align: center;

color: #333333;

cursor: pointer;

}

.lvse3px {

background: #77c210;

width: 100%;

height: 3px;

float: left;

position: absolute;

bottom: -3px;

}

.huangse3px {

background: #ffd15f;

width: 100%;

height: 3px;

float: left;

position: absolute;

bottom: -3px;

}

.fense3px {

background: #eb5da7;

width: 100%;

height: 3px;

float: left;

position: absolute;

bottom: -3px;

}

.juse3px {

background: #ff954d;

width: 100%;

height: 3px;

float: left;

position: absolute;

bottom: -3px;

}

.lanse3px {

background: #559eea;

width: 100%;

height: 3px;

float: left;

position: absolute;

bottom: -3px;

}

.bottom {

width: 1110px;

height: 243px;

/*background: slateblue;*/

margin: 0 auto;

}

.left {

float: left;

width: 350px;

height: 222px;

background: white;

margin-top: 20px;

}

.left>img {

width: 350px;

height: 200px;

}

.xulleft {}

.xulleft>li {

list-style: none;

width: 12px;

height: 12px;

background: #e5e5e5;

border-radius: 50%;

float: left;

cursor: pointer;

margin-right: 5px;

}

.xulleft>li:first-child {

margin-left: 133px;

}

.xulleft>li:hover {

background: #288bde;

}

.md {

width: 348px;

height: 220px;

background: white;

float: left;

margin-top: 21px;

margin-left: 30px;

position: relative;

}

.bottomP1 {

float: left;

font-family: "微软雅黑";

font-size: 15px;

height: 15px;

line-height: 15px;

color: #999999;

margin-top: 5px;

}

.bottomP2 {

float: left;

font-family: "微软雅黑";

font-size: 19px;

height: 19px;

line-height: 19px;

color: #0077dd;

margin-left: 19px;

}

.md_left {

width: 160px;

height: 180px;

/*background: seagreen;*/

float: left;

position: absolute;

top: 40px;

}

.wunai {

position: relative;

width: 160px;

height: 120px;

overflow: hidden;

}

.wunai>img {

width: 160px;

height: 120px;

vertical-align: top;

}

.wunai>p {

width: 160px;

height: 120px;

background: rgba(0, 0, 0, 0.4);

/*color: floralwhite;*/

text-align: center;

font-family: "微软雅黑";

font-size: 12px;

position: absolute;

top: 90px;

line-height: 30px;

transition: top 1s;

color: #FFFFFF;

}

.wunai:hover>p {

top: 0;

}

.md_ul {

float: left;

position: relative;

}

.md_ul>li {

list-style: none;

font-family: "微软雅黑";

font-size: 12px;

height: 12px;

line-height: 12px;

float: left;

margin-top: 18px;

position: relative;

}

.hui3px {

width: 3px;

height: 3px;

background: #dbdbdb;

margin-top: 4px;

margin-right: 7px;

float: left;

}

.md_right {

width: 168px;

height: 180px;

/*background: seagreen;*/

position: absolute;

right: 0;

top: 40px;

}

.md_right_p1 {

font-family: "微软雅黑";

font-size: 15px;

height: 15px;

line-height: 21px;

font-weight: 600;

}

.md_right_p2 {

font-family: "微软雅黑";

font-size: 12px;

height: 12px;

line-height: 12px;

margin-top: 37px;

color: #333333;

}

.md_right_p3 {

font-family: "微软雅黑";

font-size: 12px;

height: 12px;

line-height: 12px;

margin-top: 10px;

color: #333333;

}

.submit {

width: 90px;

height: 25px;

background: #ff8800;

border: 0;

cursor: pointer;

color: #ffffff;

border-radius: 3px;

margin-top: 9px;

}

.right {

width: 330px;

height: 221px;

/*background: seagreen;*/

float: right;

margin-top: 20px;

position: relative;

}

.right_P {

font-family: "微软雅黑";

font-size: 20px;

line-height: 20px;

height: 20px;

color: #0077dd;

float: left;

}

.tupian {

width: 160px;

height: 120px;

margin-top: 40px;

position: relative;

overflow: hidden;

}

.tupian>img {

width: 160px;

height: 120px;

vertical-align: top;

}

.tupian>p {

width: 160px;

height: 120px;

background: rgba(0, 0, 0, 0.4);

color: #FFFFFF;

font-family: "微软雅黑";

font-size: 12px;

line-height: 30px;

text-align: center;

position: absolute;

top: 90px;

transition: top 1s;

}

.tupian:hover>p {

top: 0;

}

.right_ul {

/*float: left;*/

}

.right_ul>li {

list-style: none;

font-family: "微软雅黑";

font-size: 12px;

line-height: 12px;

margin-top: 18px;

}

.tupian1 {

width: 160px;

height: 120px;

margin-top: 40px;

position: relative;

overflow: hidden;

left: 170px;

bottom: 220px;

}

.tupian1>img {

width: 160px;

height: 120px;

vertical-align: top;

}

.tupian1>p {

width: 160px;

height: 120px;

background: rgba(0, 0, 0, 0.4);

color: #FFFFFF;

font-family: "微软雅黑";

font-size: 12px;

line-height: 30px;

text-align: center;

position: absolute;

top: 90px;

transition: top 1s;

}

.tupian1:hover>p {

top: 0;

}

.lastul {

position: absolute;

top: 158px;

left: 170px;

}

.lastul>li {

list-style: none;

font-family: "微软雅黑";

font-size: 12px;

line-height: 12px;

margin-top: 18px;

}


运行结果


达到自己预期,但是我觉得还需要练习
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容