这篇文章主要介绍“如何利用纯css3实现360度翻转的按钮”,在日常操作中,相信很多人在如何利用纯css3实现360度翻转的按钮问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何利用纯css3实现360度翻转的按钮”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!
今天要给大家分享的是由css3实现的翻转360动画按钮。之前已为大家分享了好几款css3按钮,大家可以点击链接进去找一找适合自己的。哈哈。下面先为大家上效果图:
下面是实现的代码。
html代码:
XML/HTML Code复制内容到剪贴板
<ul class="flatflipbuttons">
<li><a href="https://www.yisu.com" title="Search"><span class="icon-search"></span>
</a><b>Search</b></li>
<li><a href="https://www.yisu.com"><span class="icon-gears"></span></a><b>Gears</b></li>
<li><a href="https://www.yisu.com"><span class="icon-rss"></span></a><b>RSS</b></li>
<li><a href="https://www.yisu.com"><span class="icon-twitter"></span></a><b>Twitter</b></li>
<li><a href="https://www.yisu.com"><span class="icon-rocket"></span></a><b>Rocket</b></li>
</ul>
<br />
<br />
<ul class="flatflipbuttons second">
<li><a href="https://www.yisu.com"><span>
<img src="imgs/rss-heart.png" /></span></a></li>
<li><a href="https://www.yisu.com"><span>
<img src="imgs/twitter-heart.png" /></span></a></li>
<li><a href="https://www.yisu.com"><span>
<img src="imgs/facebook-heart.png" /></span></a></li>
<li><a href="https://www.yisu.com"><span>
<img src="imgs/google-heart.png" /></span></a></li>
<li><a href="https://www.yisu.com"><span>
<img src="imgs/stumble-heart.png" /></span></a></li>
</ul>
css代码:
CSS Code复制内容到剪贴板
ul.flatflipbuttons
{
margin: 0;
padding: 0;
list-style: none;
-webkit-perspective: 10000px; /* larger the value, the less pronounced the 3D effect */
-moz-perspective: 10000px;
perspective: 10000px;
}
ul.flatflipbuttons li
{
margin: 0;
display: inline-block;
width: 100px; /* dimensions of buttons. */
height: 100px;
margin-right: 15px; /* spacing between buttons */
background: white;
text-transform: uppercase;
text-align: center;
}
ul.flatflipbuttons li a
{
display: table;
font: bold 36px Arial; /* font size, pertains to icon fonts specifically */
width: 100%;
height: 100%;
margin-bottom: 4px;
color: black;
background: #3B9DD5;
text-decoration: none;
outline: none;
-webkit-transition: all 300ms ease-out; /* CSS3 transition. Last value is pause before transition play */
-moz-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
ul.flatflipbuttons li:nth-of-type(1) a
{
color: white;
background: #3B9DD5;
}
ul.flatflipbuttons li:nth-of-type(2) a
{
background: #A1CD3A;
}
ul.flatflipbuttons li:nth-of-type(3) a
{
background: #80C5EC;
}
ul.flatflipbuttons li:nth-of-type(4) a
{
color: white;
background: #635746;
}
ul.flatflipbuttons li:nth-of-type(5) a
{
background: #F2C96D;
}
ul.flatflipbuttons li a span
{
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: table-cell;
vertical-align: middle;
width: 100%;
height: 100%;
-webkit-transition: all 300ms ease-out; /* CSS3 transition. */
-moz-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
ul.flatflipbuttons li b
{
/* CSS for text beneath button */
display: block;
position: relative;
width: 100%;
opacity: 0;
-webkit-transition: all 300ms ease-out 0.2s; /* CSS3 transition. 0.2s delay */
-moz-transition: all 300ms ease-out 0.2s;
transition: all 300ms ease-out 0.2s;
}
ul.flatflipbuttons li a img
{
/* CSS for image if defined inside button */
border-width: 0;
vertical-align: middle;
}
ul.flatflipbuttons li:hover a
{
-webkit-transform: rotateY(180deg); /* flip horizontally 180deg*/
-moz-transform: rotateY(180deg);
transform: rotateY(180deg);
background: #c1e4ec; /* bgcolor of button onMouseover*/
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
transition-delay: 0.2s;
}
ul.flatflipbuttons li:hover a span
{
color: black; /* color of icon font onMouseover */
-webkit-transform: rotateY(180deg);
-moz-transform: rotateY(180deg); /* flip horizontally 180deg*/
transform: rotateY(180deg);
-webkit-transition-delay: 0.2s;
-moz-transition-delay: 0.2s;
transition-delay: 0.2s;
}
ul.flatflipbuttons li:hover b
{
opacity: 1;
}
/* CSS for 2nd menu below specifically */
ul.second li a
{
background: #eee !important;
}
ul.second li a:hover
{
background: #ddd !important;
}
到此,关于“如何利用纯css3实现360度翻转的按钮”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。