为了账号安全,请及时绑定邮箱和手机立即绑定

老师,我们家这个课后作业怎么这么难啊?????

我好像个智障,全白学了。。。。。。。。。。。。。。。

正在回答

1 回答

<!doctype html>

<html>

<head>

<meta charset="UTF-8">

<title>制作3D旋转导航</title>

<style>

* {

list-style: none;

}


/*任务一:引入本地字体文件*/


body {

background-color: #edecec;

}


/* basic menu styles */

.nav-menu {

display: block;

background: #74adaa;

width: 950px;

margin: 50px auto 150px;

}


.nav-menu>li {

display: inline;

float: left;

border-right: 1px solid #94c0be;

}


.nav-menu>li:last-child {

border-right: none;

}


.nav-menu li a {

color: #fff;

display: block;

text-decoration: none;

/*调用本地字体*/

font-family: 'sansationregular';

font-smoothing: antialiased;

text-transform: capitalize;

overflow: visible;

line-height: 20px;

font-size: 20px;

padding: 15px 30px 15px 31px;

}



.three-d {


/* 任务三、设置3D舞台布景 */

perspective: 200px;


/*任务四、设置3D舞台布景过渡效果*/

transition: all 0.7s linear;

position: relative;

}


.three-d:not(.active):hover {

cursor: pointer;

}


/*任务五、给不是当前状态的3D舞台的悬浮与聚焦状态设置变形效果*/

.three-d:not(.active):hover .three-d-box,

.three-d:not(.active):focus .three-d-box {

transform: translateZ(-25px) rotateX(90deg);

}


.three-d-box {

/*任务六、给3D舞台中“.three-d-box”设置过渡与变形效果*/

transform: translateZ(-25px);

transition: all .3s ease-out;

transform-style: preserve-3d;

pointer-events: none;

position: absolute;

top: 0;

left: 0;

display: block;

width: 100%;

height: 100%;

}


/*任务七、给导航设置3D前,与3D后变形效果*/

.front {

transform: rotateX(0deg) translateZ(25px);

}


.back {

transform: rotateX(-90deg) translateZ(25px);

color: #FFE7C4;

}


.front,

.back {

display: block;

width: 100%;

height: 100%;

position: absolute;

top: 0;

left: 0;

background: #74adaa;

padding: 15px 30px 15px 31px;

color: white;

pointer-events: none;

box-sizing: border-box;

}


/*任务八、设置导航当前状态与悬浮状态下的背景效果*/

.nav-menu li .active .front,

.nav-menu li .active .back,

.nav-menu li a:hover .front,

.nav-menu li a:hover .back {

background-color: #51938F;

background-size: 5px 5px;

background-position: 0 0, 30px 30px;

background-image: -webit-linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480);

background-image: -moz-linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480);

background-image: -ms-linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480);

background-image: -o-linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480);

background-image: linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480), linear-gradient(45deg, #478480 25%, transparent 25%, transparent 75%, #478480 75%, #478480);

/*background-image: -webkit-linear-gradient(45deg,#434238 25%,transparent 25%,transparent 75%,#434238 75%,#434238),-ms-linear-gradient(45deg,#434238 25%,transparent 25%,transparent 75%,#434238 75%,#434238),-moz-linear-gradient(45deg,#434238 25%,transparent 25%,transparent 75%,#434238 75%,#434238),-o-linear-gradient(45deg,#434238 25%,transparent 25%,transparent 75%,#434238 75%,#434238),linear-gradient(45deg,#434238 25%,transparent 25%,transparent 75%,#434238 75%,#434238);*/

}


.nav-menu ul {

position: absolute;

text-align: left;

line-height: 40px;

font-size: 14px;

width: 200px;

transition: all 0.3s ease-in;

transform-origin: 0px 0px;

transform: rotateX(-90deg);

backface-visibility: hidden;

}


/*任务九、显示下拉导航菜单,并其设置一个变形效果*/

.nav-menu>li:hover ul {

display: block;

transform: rotateX(0deg);

}

</style>

</head>

<body>

<div id="nav">

<ul class="nav-menu clearfix unstyled">

<li><a href="#" class="three-d active">

Home

<span class="three-d-box"><span class="front">Home</span><span class="back">Home</span></span>

</a></li>

<li><a href="#" class="three-d">

Services

<span class="three-d-box"><span class="front">Services</span><span class="back">Services</span></span>

</a></li>

<li><a href="#" class="three-d">

Products

<span class="three-d-box"><span class="front">Products</span><span class="back">Products</span></span>

</a></li>

<li><a href="#" class="three-d">

About

<span class="three-d-box"><span class="front">About</span><span class="back">About</span></span>

</a></li>

<li><a href="#" class="three-d">

Contact

<span class="three-d-box"><span class="front">Contact</span><span class="back">Contact</span></span>

</a></li>

<li><a href="#" class="three-d">

Blog

<span class="three-d-box"><span class="front">Blog</span><span class="back">Blog</span></span></a>

<ul class="clearfix unstyled drop-menu">

<li><a href="#" class="three-d">

Html5

<span class="three-d-box"><span class="front">Html5</span><span class="back">Html5</span></span>

</a></li>

<li><a href="#" class="three-d">

Css3

<span class="three-d-box"><span class="front">Css3</span><span class="back">Css3</span></span>

</a></li>

<li><a href="#" class="three-d">

JavaScript

<span class="three-d-box"><span class="front">JavaScript</span><span class="back">JavaScript</span></span>

</a></li>

<li><a href="#" class="three-d">

Videogames

<span class="three-d-box"><span class="front">Videogames</span><span class="back">Videogames</span></span>

</a></li>

</ul>

</li>

<li><a href="#" class="three-d">

Shop On-line

<span class="three-d-box"><span class="front">Shop On-line</span><span class="back">Shop On-line</span></span>

</a></li>

</ul>

</div>

</body>

</html>


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
十天精通CSS3
  • 参与学习       242632    人
  • 解答问题       2623    个

本课程为CSS3入门教程,深刻详解CSS3知识让网页穿上绚丽装备

进入课程

老师,我们家这个课后作业怎么这么难啊?????

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信